webForumDet fria alternativet

Behöver hjälp

ASP

2 svar · 172 visningar · startad av kaj19

Medlem sedan feb. 2001378 inlägg
Frågan#1

Får inte att funka.

<%
Dim objConn 'as object
Dim strConn 'as string
Dim rstUser 'as Recordset

Set objConn = Server.CreateObject("ADODB.Connection")
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("db/community.mdb")
objConn.Open strConn

strSQL = "SELECT userID FROM tblUsers WHERE userID = '" & request.querystring("userID") & "'"

Set rstUser = Server.CreateObject("ADODB.Recordset")
rstUser.Open strSQL, objConn, 3, 3 %>

<html>
  <head>
    <title>Andvändarninfo</title>
  </head>
  <body>
    <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="47%" height="196">
      <tr>
        <td width="10%" height="1" rowspan= "5"><img src="<%=rstUser("userPictureURL")%>" width="78" height="110" hspace="0" style="padding: 0"></td>
        <td width="90%" height="1">Namn: <%=rstUser("userFullName")%></td>
      </tr>
      <tr>
        <td width="90%" height="21">Email: <%=rstUser("userEmail")%></td>
      </tr>
      <tr>
        <td width="90%" height="21">Poäng: <%=rstUser("userPoints")%></td>
      </tr>
      <tr>
        <td width="90%" height="10">Senast inloggad: <%=rstUser("userLoginLatest")%></td>
      </tr>
      <tr>
        <td width="90%" height="10">Reggad: <%=rstUser("userRegisrerad")%></td>
      </tr>
      <tr>
        <td width="90%" height="5">
          <b>< br>         <%
         if rst("userLoginStatus") = "1" Then
           %>
           <font color="#008000">Online</font>< br>           <%
         else
           %>
            <font color="#FF0000">Offline</font>
         <%
         end if
         %>
         </b>
        </td>
      </tr>
      <tr>
        <td width="10%" height="102">&nbsp;</td>
        <td width="90%" height="102" valign="top">Presentation:<br><%=rstUser("userPresentation")%></td>
      </tr>
    </table>
  <%
   If Request.QueryString("userID") = Session("userID") Then
    %>
   <a href="userInfoEdit.asp">Ändra din profil</a>< br>    <%
   end if
   %>
  </body>
</html>
<%

objConn.Close
rstUser.Close
Set rstUser = nothing
Set objConn = nothing
%>

Får denna fel meddelande:

Microsoft JET Database Engine error '80040e07' 

Data type mismatch in criteria expression. 

/swejack/test/userInfo.asp, line 16

Inte funkar heller denna heller.

<%
Dim objConn 'as object
Dim strConn 'as string
Dim rstUser 'as Recordset

Set objConn = Server.CreateObject("ADODB.Connection")
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("db/community.mdb")
objConn.Open strConn

strSQL = "SELECT userID FROM tblUsers WHERE userID = '" & request.querystring("userID") & "'"

Set rstUser = Server.CreateObject("ADODB.Recordset")
rstUser.Open strSQL, objConn, 3, 3 %>

<html>
  <head>
    <title>Andvändarninfo</title>
  </head>
  <body>
    <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="47%" height="196">
      <tr>
        <td width="10%" height="1" rowspan= "5"><img src="<%=rstUser("userPictureURL")%>" width="78" height="110" hspace="0" style="padding: 0"></td>
        <td width="90%" height="1">Namn: <%=rstUser("userFullName")%></td>
      </tr>
      <tr>
        <td width="90%" height="21">Email: <%=rstUser("userEmail")%></td>
      </tr>
      <tr>
        <td width="90%" height="21">Poäng: <%=rstUser("userPoints")%></td>
      </tr>
      <tr>
        <td width="90%" height="10">Senast inloggad: <%=rstUser("userLoginLatest")%></td>
      </tr>
      <tr>
        <td width="90%" height="10">Reggad: <%=rstUser("userRegisrerad")%></td>
      </tr>
      <tr>
        <td width="90%" height="5">
          <b>< br>         <%
         if rst("userLoginStatus") = "1" Then
           %>
           <font color="#008000">Online</font>< br>           <%
         else
           %>
            <font color="#FF0000">Offline</font>
         <%
         end if
         %>
         </b>
        </td>
      </tr>
      <tr>
        <td width="10%" height="102">&nbsp;</td>
        <td width="90%" height="102" valign="top">Presentation:<br><%=rstUser("userPresentation")%></td>
      </tr>
    </table>
  <%
   If Request.QueryString("userID") = Session("userID") Then
    %>
   <a href="userInfoEdit.asp">Ändra din profil</a>< br>    <%
   end if
   %>
  </body>
</html>
<%

objConn.Close
rstUser.Close
Set rstUser = nothing
Set objConn = nothing
%>

Får detta meddelande:

Microsoft VBScript runtime error '800a000d' 

Type mismatch 

/swejack/test/userInfoedit.asp, line 53

RED av OveRRidE) Använd kodtaggar, tack!

Medlem sedan dec. 20003 887 inlägg
#2

Och rad 53 är för oss som inte vet?

Medlem sedan dec. 200012 464 inlägg
#3
strSQL = "SELECT userID FROM tblUsers WHERE userID = " & request.querystring("userID")
258 ms totalt · 4 externa anrop · v20260731065814-full.86ec41c2
124 ms — deklarationer (db)
0 ms — hämta statistik (cache)
130 ms — hämta tråd, inlägg och bilagor (db)
125 ms — ändringar (db)