Avatar billede mindcrawler Nybegynder
11. februar 2003 - 16:35 Der er 1 kommentar og
1 løsning

En lille komplikation!

Hej jeg for følgende fejl:
------------------------------------------


Request object error 'ASP 0102 : 80004005'
Expecting string input

/1/databaser/linksystem/linkadder.asp, line 288

The function expects a string as input.



I følgende script:
------------------------------------------


<%Response.Buffer=True

If Request.Querystring("mess") = "link"  Then
  mess = "alert('Bara en länk per dag!');return true;"
End If

Coo = "dsdaf"
Coo2 = "Uhasdf"
%>

<html>
<head>
<title>Super cars</title>
<link rel="stylesheet" href="style.css" type="text/css">
<script src="js.js"></script>
</head>

<body onLoad="<%=mess%>">

<%db = Server.MapPath("db/linkz.mdb")        'Sökvägen till databasen

Set Conn = Server.CreateObject("ADODB.Connection")
Set RecSet = Server.CreateObject("ADODB.Recordset")
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source ="& db%>

<table align="center" width="450">

<% If Request.QueryString("do") = "" Then

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

With RecSet
  .CursorLocation = 3
  .CacheSize = perSida
End With

SQL = "SELECT * FROM linkz ORDER BY id DESC"
RecSet.Open SQL, Conn

If RecSet.EOF Then
  Response.Write "<tr><td>No links</td></tr>"
Else

With RecSet
  .MoveFirst
  .PageSize = perSida
  .AbsolutePage = sida
End With

Sidor =  RecSet.PageCount
count = 0
X = 0%>

    <tr>
      <td>
[<a href="linkadder.asp?do=add">Add link</a>]&nbsp;&nbsp;
[<a href="linkadder.asp?do=all">Sort </a>]
      </td>
      <td align="right"><a href="sok.asp">Search link</a>
<%If Sidor = 1 Then
Else%>
        &nbsp;  &nbsp;  &nbsp;  &nbsp;
        <%If (Int(sida)) <> 1 Then%>
        <a href="linkadder.asp?id=<%=Request.QueryString("id")%>&sida=<%=(Int(sida)-1)%>"><b>Back</b></a>
        <%Else
        Response.Write ""
        End If%>&nbsp;|&nbsp;
        <%If (Int(sida)) <> (Int(Sidor)) Then%>
        <a href="linkadder.asp?id=<%=Request.QueryString("id")%>&sida=<%=(Int(sida)+1)%>"><b>Next</b></a>
        <%Else
        Response.Write ""
        End If
End If%>
      </td>
    </tr>
<%If Sidor = 1 Then
Else%>
    <tr>
      <td height="10" colspan="2"><img src="bilder/dot2.gif"></td>
  </tr>
    <tr>
      <td colspan="2"><b>
      <%For Sid = 1 To Sidor
            If (Int(Sid)) = (Int(sida)) Then Response.Write Sid Else Response.Write " <a href=linkadder.asp?sida="& Sid &">" & Sid & "</a> " End If
        Next%>
      </b>
      </td>
    </tr>
<%End If%>
    <tr>
      <td height="10" colspan="2"><img src="bilder/dot2.gif"></td>
  </tr>
<%Set A = Conn.Execute("SELECT Count(*) As antal FROM linkz")%>
<%Set B = Conn.Execute("SELECT Sum(hitz) As klick FROM linkz")%>
    <tr>
      <td height="10" colspan="2">
            We have <b><%=A("antal")%></b> links with <b><%=B("klick")%></b> visits.
      </td>
  </tr>
<%A.Close
Set A = Nothing
B.Close
Set B = Nothing%>
    <tr>
      <td height="10" colspan="2"><img src="bilder/dot2.gif"></td>
  </tr>

<%Do While Not RecSet.EOF And X < RecSet.PageSize
If Count = 2 Then
Response.Write "<tr>"
Count = 0
End If
       
Namn = RecSet("namn")
Link= RecSet("link")

If Count = 2 Then
Response.Write "<tr>"
Count = 0
End If%>
<td width="50%">[<%=RecSet("hitz")%>] <a href="linkadder.asp?visa=url&id=<%=RecSet("id")%>" target="_blank" OnClick="java script:location.reload()" onMouseOver="self.status='<%=RecSet("link")%>';return true" onMouseOut="self.status=' ';return true"><%=Namn %></a></td>
<%
X=X+1
count = count + 1
RecSet.MoveNext
Loop
               
RecSet.Close
Set RecSet = Nothing
   
End If
If Sidor = 1 Then
Else%>
    <tr>
      <td height="10" colspan="2"><img src="bilder/dot2.gif"></td>
  </tr>
    <tr>
      <td colspan="2"><b>
      <%For Sid = 1 To Sidor
            If (Int(Sid)) = (Int(sida)) Then Response.Write Sid Else Response.Write " <a href=linkadder.asp?sida="& Sid &">" & Sid & "</a> " End If
        Next%>
      </b>
      </td>
    </tr>
<%End If%>
</table>
<br>

<%End If%>

<% If Request.QueryString("do") = "all" Then

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

With RecSet
  .CursorLocation = 3
  .CacheSize = perSida1
End With

SQL = "SELECT * FROM linkz ORDER BY hitz desc"
RecSet.Open SQL, Conn

If RecSet.EOF Then
  Response.Write "Inga länkar<br>"
Else

With RecSet
  .MoveFirst
  .PageSize = perSida1
  .AbsolutePage = sida
End With

Sidor =  RecSet.PageCount
count = 0
X = 0%>

    <tr>
      <td>
[<a href="linkadder.asp?do=add">Add link</a>]&nbsp;&nbsp;
[<a href="linkadder.asp">Back</a>]
      </td>
      <td align="right"><a href="sok.asp">Search link</a>
<%If Sidor = 1 Then
Else%>
        &nbsp;  &nbsp;  &nbsp;  &nbsp;
        <%If (Int(sida)) <> 1 Then%>
        <a href="linkadder.asp?do=all&sida=<%=(Int(sida)-1)%>"><b>Back</b></a>
        <%Else
        Response.Write ""
        End If%>&nbsp;|&nbsp;
        <%If (Int(sida)) <> (Int(Sidor)) Then%>
        <a href="linkadder.asp?do=all&sida=<%=(Int(sida)+1)%>"><b>next</b></a>
        <%Else
        Response.Write ""
        End If
End If%>
      </td>
    </tr>
<%If Sidor = 1 Then
Else%>
    <tr>
      <td height="10" colspan="2"><img src="bilder/dot2.gif"></td>
  </tr>
    <tr>
      <td colspan="2"><b>
      <%For Sid = 1 To Sidor
            If (Int(Sid)) = (Int(sida)) Then Response.Write Sid Else Response.Write " <a href=linkadder.asp?do=all&sida="& Sid &">" & Sid & "</a> " End If
        Next%>
      </b>
      </td>
    </tr>
<%End If%>
    <tr>
      <td height="10" colspan="2"><img src="bilder/dot2.gif"></td>
  </tr>
<%Set A = Conn.Execute("SELECT Count(*) As antal FROM linkz")%>
<%Set B = Conn.Execute("SELECT Sum(hitz) As klick FROM linkz")%>
    <tr>
      <td height="10" colspan="2">
            We have <b><%=A("antal")%></b> links with <b><%=B("klick")%></b> visits
      </td>
  </tr>
<%A.Close
Set A = Nothing
B.Close
Set B = Nothing%>
    <tr>
      <td height="10" colspan="2"><img src="bilder/dot2.gif"></td>
  </tr>

<%Do While Not RecSet.EOF And X < RecSet.PageSize
If Count = 2 Then
Response.Write "<tr>"
Count = 0
End If
       
Namn = RecSet("namn")
Link= RecSet("link")

If Count = 2 Then
Response.Write "<tr>"
Count = 0
End If%>
<td width="50%">[<%=RecSet("hitz")%>] <a href="linkadder.asp?visa=url&id=<%=RecSet("id")%>" target="_blank" OnClick="java script:location.reload()" onMouseOver="self.status='<%=RecSet("link")%>';return true" onMouseOut="self.status=' ';return true"><%=Namn %></a></td>
<%
X=X+1
count = count + 1
RecSet.MoveNext
Loop
               
RecSet.Close
Set RecSet = Nothing
   
End If
If Sidor = 1 Then
Else%>
    <tr>
      <td height="10" colspan="2"><img src="bilder/dot2.gif"></td>
  </tr>
    <tr>
      <td colspan="2"><b>
      <%For Sid = 1 To Sidor
            If (Int(Sid)) = (Int(sida)) Then Response.Write Sid Else Response.Write " <a href=linkadder.asp?do=all&sida="& Sid &">" & Sid & "</a> " End If
        Next%>
      </b>
      </td>
    </tr>
<%End If%>
</table>
<br>

<%End If
If Request.QueryString("do") = "add" Then
  If Request.Cookies(Coo1).Haskeys = false Then
      Response.Cookies(Coo1)(Coo1) = Coo1
      Response.Cookies(Coo1).Expires = date + 1
      Response.Redirect "linkadder.asp?do=adda"
  Else
      Response.Redirect "linkadder.asp?mess=link"
  End If
End If
If Request.QueryString("do") = "adda" Then%>

<table align="center" width="450">
    <tr>
      <td>
[<a href="linkadder.asp?do=add" >Add link</a>]&nbsp;&nbsp;
[<a href="linkadder.asp">Back</a>]
      </td>
      <td align="right"><a href="sok.asp">Search link</a></td>
    </tr>
    <tr>
      <td height="10" colspan="2"><img src="bilder/dot2.gif"></td>
  </tr>
  <form name="linkz" method="post" action="linkadder.asp?do=added" onSubmit="return LinkIn()">
    <tr>
      <td colspan="2"><b>Site name:</b><br><input type="text" name="namn" size="50"></td>
    </tr>
    <tr>
      <td colspan="2"><b>Link location:</b><br><input type="text" name="link" size="50" value="http://"></td>
    </tr>
    <tr>
      <td colspan="2"><input type="submit" name="Submit" value="Lägg till"></td>
    </tr>
  </form>
</table>

<%End If
If Request.QueryString("do") = "added" Then
  If Request.Cookies(Coo2).Haskeys = FALSE Then
      Response.Cookies(Coo2)(Coo2) = Coo2
      Response.Cookies(Coo2).Expires = date + 1

Namn  = Request.Form("namn")
Link      = Request.Form("link")
If Link <> "" Then
  If Left(Link,7) = "http://" Then
    Link = Link
  Else
    Link = "http://" & Link
  End If
End If

      Response.Redirect "linkadder.asp?do=done&namn=" & Namn & "&link=" & Link
  Else
      Response.Redirect "linkadder.asp?mess=link"
  End If
End If
If Request.QueryString("do") = "done" Then

Ip = Request.Servervariables("REMOTE_ADDR")

Conn.Execute("Insert Into linkz(Namn,Link,Ip) Values('"& Request.QueryString("Namn") &"','"& Request.QueryString("Link") &"','"& Ip &"')")
Response.Redirect "linkadder.asp"

End If
If Request.QueryString("visa") = "url" Then
  Set RecSet=Conn.Execute("SELECT * From Linkz WHERE id=" & Request.Querystring("id"))
  Conn.Execute("UPDATE Linkz SET Hitz=Hitz+1 WHERE ID=" & Request.Querystring("id"))
  Response.Redirect RecSet("Link")
End If%>

</body>
</html>
Avatar billede medions Nybegynder
11. februar 2003 - 16:38 #1
Tror du ik' det er fordi variablen Coo1 er empty?

//>Rune
Avatar billede mindcrawler Nybegynder
11. februar 2003 - 16:45 #2
Hmm... hvad mener du? Efter hvad jeg kan se står mine variabler da okay.
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester