---
title: "Felmess"
type: "forum-thread"
url: "https://www.webforum.nu/amne/asp/74487-felmess"
topic: "ASP"
topic_url: "https://www.webforum.nu/amne/asp"
author: "Asa"
published: "2003-04-19T10:54:47.000Z"
updated: "2003-04-24T10:27:33.000Z"
replies: 11
views: 350
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/asp/74487-felmess"
---

# Felmess

## #1 — Asa, 2003-04-19T10:54Z

Jag har en sida där jag kan söka på massa fält och när jag söker så får jag felmess i själva sidnavigeringen. En bit ovanför har jag skrivit ifsats som kollar om den ska plocka ifrån formuläret eller ifrån Querystringen. Den ser ut så här:

```
<%If Request.QueryString("action") = "search" Then
  AdType     = Request.Form("typ")
  Kat        = Request.Form("kat")
  County     = Request.Form("county")
  SearchWord = Request.Form("searchWord")
Else
  AdType     = Request.QueryString("typ")
  Kat        = Request.QueryString("kat")
  County     = Request.QueryString("county")
  SearchWord = Request.QueryString("searchWord")
End If%>

      <%If (Int(sida)) <> 1 Then%>
        <a href="viewAd.asp?<%If Request.QueryString("action") = "search" Then%>action=search&searchWord=<%=SearchWord%>&<%End If%>kat=<%=Kat%>&typ=<%=AdType%>&county=<%=County%>&sida=<%=(Int(sida)-1)%>"><b>Bakåt</b></a> |
      <%End If
      For Sid = 1 To Sidor
        If (Int(Sid)) = (Int(sida)) Then%><b><%=Sid%></b><%Else%> <a href="viewAd.asp?<%If Request.QueryString("action") = "search" Then%>action=search&searchWord=<%=SearchWord%>&<%End If%>kat=<%=Kat%>&typ=<%=AdType%>&county=<%=County%>&sida=<%=Sid%>"><%=Sid%></a> <%End If
      Next
      If (Int(sida)) <> (Int(Sidor)) Then%>
        | <a href="viewAd.asp?<%If Request.QueryString("action") = "search" Then%>action=search&searchWord=<%=SearchWord%>&<%End If%>kat=<%=Kat%>&typ=<%=AdType%>&county=<%=County%>&sida=<%=(Int(sida)+1)%>"><b>Framåt</b></a>
      <%End If%>
```

Tar jag bort själva sidnavigeringen får jag inget felmess.

```
Feltyp:
Response-objekt, ASP 0185 (0x8002000E)
En av objektets standardegenskaper kan inte hittas.
/jobb/pm/viewAd.asp
```

Är säkert ett enkelt fel men jag vetefan!

Permalänk: https://www.webforum.nu/p/74487

## #2 — voigtann1, 2003-04-19T11:03Z

när jag kör:

```
<%
If Request.QueryString("action") = "search" Then
  AdType     = Request.Form("typ")
  Kat        = Request.Form("kat")
  County     = Request.Form("county")
  SearchWord = Request.Form("searchWord")
Else
  AdType     = Request.QueryString("typ")
  Kat        = Request.QueryString("kat")
  County     = Request.QueryString("county")
  SearchWord = Request.QueryString("searchWord")
End If

If (Int(sida)) <> 1 Then
  response.write "<a href='viewAd.asp?"
    If Request.QueryString("action") = "search" Then
      response.write "action=search&searchWord="& SearchWord &"&"
    End If
  response.write "kat=" &Kat& "&typ=" &AdType& "&county=" &County& "&sida=" &(Int(sida)-1)& "'><b>Bakåt</b></a> |"
End If

For Sid = 1 To Sidor
  If (Int(Sid)) = (Int(sida)) Then
    response.write "<b>" &Sid& "</b>"
  Else
    response.write "<a href='viewAd.asp?"
      If Request.QueryString("action") = "search" Then
        response.write "action=search&searchWord=" &SearchWord& "&"
      End If
    response.write "kat=" &Kat& "&typ=" &AdType& "&county=" &County& "&sida=" &Sid& "'>" &Sid& "</a>"
  End If
Next

If (Int(sida)) <> (Int(Sidor)) Then
  response.write " | <a href='viewAd.asp?"
    If Request.QueryString("action") = "search" Then
      response.write "action=search&searchWord=" &SearchWord& "&"
    End If
  response.write "kat=" &Kat& "&typ=" &AdType& "&county=" &County& "&sida=" &(Int(sida)+1)& "'><b>Framåt</b></a>"
End If
%>
```

 så får jag inga fel meddelande :(

Permalänk: https://www.webforum.nu/p/1017078

## #3 — Asa, 2003-04-20T00:50Z

Jag har självklart mer kod men ska jag visa det blire så mycket!

Permalänk: https://www.webforum.nu/p/1017537

## #4 — LeonL, 2003-04-20T13:35Z

Kan det vara så att du har använt ett ord som är i själva verket en funktion e.d.?

\[edit\]
Eller nääh... voig...(?) testade ju koden och han fick ju inget felmess...

Permalänk: https://www.webforum.nu/p/1017780

## #5 — @nders, 2003-04-21T09:26Z

Hur ser koden ut i viewad.asp? Är det den du visar?

Permalänk: https://www.webforum.nu/p/1018340

## #6 — Asa, 2003-04-21T20:13Z

Uj uj! Det blir massa rader men jag visar väl allt då!

```
<!--#Include file="top.asp"-->

<%If Request.QueryString("action") = "search" Then
  AdType     = Request.Form("typ")
  Kat        = Request.Form("kat")
  County     = Request.Form("county")
  SearchWord = Request.Form("searchWord")
Else
  AdType     = Request.QueryString("typ")
  Kat        = Request.QueryString("kat")
  County     = Request.QueryString("county")
  SearchWord = Request.QueryString("searchWord")
End If

Set RS = Server.CreateObject("ADODB.Recordset")

Sidan = Request.QueryString("sida")
If Sidan = "" then 
  sida = 1 
Else 
  sida = Sidan 
End If 

RS.CursorLocation = 3
RS.CacheSize = 20

If SearchWord = "" Then
  If AdType = "" Then
    If County = "" Then
      If Kat = "" Then
        SQL = "Select * From ads Order By annons_id desc"
      Else
        SQL = "Select * From ads Where kategori=" & Kat & "  Order By annons_id desc"
      End if
    Else
      If Kat = "" Then    
        SQL = "Select * From ads Where county=" & County & "  Order By annons_id desc"
      Else
        SQL = "Select * From ads Where kategori=" & Kat & " And County=" & County & "  Order By annons_id desc"
      End if
    End If
  Else
    If County = "" Then
      If Kat = "" Then
        SQL = "Select * From ads Where typ=" & AdType & "  Order By annons_id desc"
      Else
        SQL = "Select * From ads Where kategori=" & Kat & " And typ=" & AdType & "  Order By annons_id desc"
      End if
    Else
      If Kat = "" Then
        SQL = "Select * From ads Where typ=" & AdType & " And County=" & County & "  Order By annons_id desc"
      Else
        SQL = "Select * From ads Where kategori=" & Kat & " And typ=" & AdType & " And County=" & County & "  Order By annons_id desc"
      End if
    End If
  End If
Else
  If AdType = "" Then
    If County = "" Then
      If Kat = "" Then
        SQL = "Select * From ads Where annonstext Like '%" & searchWord & "%' Order By annons_id desc"
      Else
        SQL = "Select * From ads Where annonstext Like '%" & searchWord & "%' And kategori=" & Kat & "  Order By annons_id desc"
      End if
    Else
      If Kat = "" Then    
        SQL = "Select * From ads Where annonstext Like '%" & searchWord & "%' And county=" & County & "  Order By annons_id desc"
      Else
        SQL = "Select * From ads Where annonstext Like '%" & searchWord & "%' And kategori=" & Kat & " And County=" & County & "  Order By annons_id desc"
      End if
    End If
  Else
    If County = "" Then
      If Kat = "" Then
        SQL = "Select * From ads Where annonstext Like '%" & searchWord & "%' And typ=" & AdType & "  Order By annons_id desc"
      Else
        SQL = "Select * From ads Where annonstext Like '%" & searchWord & "%' And kategori=" & Kat & " And typ=" & AdType & "  Order By annons_id desc"
      End if
    Else
      If Kat = "" Then
        SQL = "Select * From ads Where annonstext Like '%" & searchWord & "%' And typ=" & AdType & " And County=" & County & "  Order By annons_id desc"
      Else
        SQL = "Select * From ads Where annonstext Like '%" & searchWord & "%' And kategori=" & Kat & " And typ=" & AdType & " And County=" & County & "  Order By annons_id desc"
      End if
    End If
  End If
End If
RS.Open SQL, Conn
If Kat <> "" Then
  Set Category=Conn.Execute("Select * From category Where kat_id=" & Kat)
End If%>

<table width="100%" border="0" cellspacing="0" cellpadding="3" align="center">
  <tr valign="top"> 
    <td bgcolor="<%=BG%>" colspan="6">
      <span class="vitrubrik"><b>Visar alla annonser<%If Kat <> "" Then%> i <%=Category("kat")%><%End If%>!</B></span>
    </td>
  </tr>
  <tr valign="top"> 
    <td colspan="6"><!--#Include file="search.asp"--></td>
  </tr>
<%If RS.EOF Then%>
  <tr valign="top"> 
    <td colspan="6">Det finns inga annonser i denna kategori!</td>
  </tr>
<%Else%>
  <tr height="25">
    <td width="15%"><b><a href="#"><U>Insatt</U></a></b></td>
    <td width="5%">&nbsp;</td>
    <td width="43%"><b><a href="#"><U>Annons</U></a></b></td>
    <td width="17%" align="right"><b><a href="#"><U>Pris</U></a></b></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td width="20%"><b><a href="#"><U>Region</U></a></b></td>
  </tr>
<%x=0
RS.MoveFirst 
RS.PageSize = 20
RS.AbsolutePage = sida

Sidor =  RS.PageCount
Do While Not RS.EOF And x < RS.PageSize
Set User=Conn.Execute("Select * From members Where mem_id=" & RS("kund_NR"))
Set County=Conn.Execute("Select * From county Where id=" & RS("county"))%>
  <tr height="18">
    <td><%=FormatDateTime(RS("datum"),2)%></td>
    <td align="center"><%If RS("bild1") <> "" Or RS("bild2") <> "" Or RS("bild3") <> "" Then%><img src="gfx/fotoon.gif"><%End If%></td>
    <td><a href="viewAd.asp?ID=<%=RS("annons_ID")%>"><%=RS("rubrik")%></a></td>				
    <td align="right"><%If RS("pris") <> "" Then%><%=RS("pris")%> kr<%Else%>Ej angett<%End If%></td>
    <td>&nbsp;</td>
    <td><%=County("lan")%></td>
  </tr>
<%x=x+1
RS.MoveNext
Loop%>
</table>

<%If Sidor > 1 Then%>
<table border="0" cellpadding="0" cellspacing="3" style="border-collapse: collapse" width="100%">
  <tr>
    <td height="22">
      <%If (Int(sida)) <> 1 Then%>
        <a href="viewAd.asp?<%If Request.QueryString("action") = "search" Then%>action=search&searchWord=<%=SearchWord%>&<%End If%>kat=<%=Kat%>&typ=<%=AdType%>&county=<%=County%>&sida=<%=(Int(sida)-1)%>"><b>Bakåt</b></a> |
      <%End If
      For Sid = 1 To Sidor
        If (Int(Sid)) = (Int(sida)) Then%><b><%=Sid%></b><%Else%> <a href="viewAd.asp?<%If Request.QueryString("action") = "search" Then%>action=search&searchWord=<%=SearchWord%>&<%End If%>kat=<%=Kat%>&typ=<%=AdType%>&county=<%=County%>&sida=<%=Sid%>"><%=Sid%></a> <%End If
      Next
      If (Int(sida)) <> (Int(Sidor)) Then%>
        | <a href="viewAd.asp?<%If Request.QueryString("action") = "search" Then%>action=search&searchWord=<%=SearchWord%>&<%End If%>kat=<%=Kat%>&typ=<%=AdType%>&county=<%=County%>&sida=<%=(Int(sida)+1)%>"><b>Framåt</b></a>
      <%End If%>
    </td>
  </tr>
</table>
<%End If
End If%>

<!--#Include file="bottom.asp"-->
```

Permalänk: https://www.webforum.nu/p/1018693

## #7 — niko, 2003-04-21T20:24Z

Det är nog inte så smart att först använda *County* som en sträng:

```
County     = Request.Form("county")
```

och en stund senare (ibland, beroende på if-satsen) definiera om den till ett recordset:

```
Set County=Conn.Execute("Select * From county Where id=" & RS("county"))%>
```

Om du använder olika namn så kommer felet nog att försvinna.

Permalänk: https://www.webforum.nu/p/1018707

## #8 — Asa, 2003-04-21T21:30Z

Tackar för tipset! Ska testa det!

Permalänk: https://www.webforum.nu/p/1018817

## #9 — Asa, 2003-04-21T21:59Z

Finns det nåt smartare sätt att göra If-satserna för SQL strängarna? Som det är nu äre ju 60 rader jag har i koden. Inte kul alls med så mycket! Inget av valen är tvingande. Är denna som är om man väljer nåt på alla.

```
SQL = "Select * From ads Where annonstext Like '%" & StrsearchWord & "%' And 
kategori=" & StrKat & " And typ=" & StrType & " And 
County=" & StrCounty & "  Order By annons_id desc"
```

Permalänk: https://www.webforum.nu/p/1018858

## #10 — Asa, 2003-04-22T07:50Z

Är det någon som kan underlätta det för mig? Så jag slipper de där 60 raderna å har bara typ 10 lr nåt?

Permalänk: https://www.webforum.nu/p/1019027

## #11 — Asa, 2003-04-23T19:37Z

Någon som kan hjälpa till? Är väldigt tacksam och jag har lite bråttom! Ursäkta mitt tålamod!

Permalänk: https://www.webforum.nu/p/1023324

## #12 — Asa, 2003-04-24T10:27Z

Jag fixade så koden jag hade funkade. Hade visst gjort ett litet stavfel.

Permalänk: https://www.webforum.nu/p/1023648

---

Tråden på webben: https://www.webforum.nu/amne/asp/74487-felmess
