Jag får fel i den här koden som ska hämta ens kompisra ur en databas. Vilken datatyp har kolumnen ID1?Två databaser [LÖST]
FELMEDELANDE:
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
/muffinman/db/Acomunity/friends.asp, line 23
<!-- #include file="adovbs.inc" --> 'Line 1
<%
If Session("login") <> "ok" Then
Session("meddelande") = "You have to be online!"
Response.Redirect "login.asp"
End If
%>
<%
Set Connect2 = Server.CreateObject("ADODB.Connection")
Connect2.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath("db/db.mdb")&";"
Set RecSet2 = Server.CreateObject("ADODB.Recordset")
Set Connect = Server.CreateObject("ADODB.Connection")
Connect.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath("db/friends.mdb")&";"
Set RecSet = Server.CreateObject("ADODB.Recordset")
Addera = "Select * From friends Where ID1 = "&Session("ID") 'line 23
RecSet.Open Addera, Connect, adOpenStatic, adLockOptimistic
%>
<html>
<head>
<LINK REL=stylesheet HREF="style.css" TYPE="text/css">
<title>Registrera användare</title>
</head>
<body>
<DIV align="center">
<table width="197" cellspacing="0">
<%Do Until RecSet.EOF%>
<%Addera2 = "Select * From tblUsers Where ID = "&RecSet("ID2")
RecSet2.Open Addera2, Connect2, adOpenStatic, adLockOptimistic
%>
<tr>
<td background="images/friends.gif" align="center" width="249" height="20"><b>FRIENDS</b>
</tr>
<tr>
<td class="boxlook" valign="middle" width="249" height="160">
" target="front"><%=RecSet("username")%><%=RecSet2("poang")%>
</tr>
</table>
</DIV>
</body>
<%
RecSet2.Close
RecSet.MoveNext
Loop
Connect2.Close
Set RecSet2 = nothing
Set Connect2 = nothing
RecSet.Close
Connect.Close
Set RecSet = nothing
Set Connect = nothing
%>
</html>
Svara
Sv: Två databaser
<code>
'om det är text
Addera = "Select * From friends Where ID1 = '"&Session("ID") & "'"
</code>