asp_databases thread: SV: RE: Integers and values...argh.. =/
Thanks a lot, Peter!! =)
--
Martin Johansson,
CEO & Project Supervisor
SD-Studios
+46 (0)70-3003320
http://www.sd-studios.com
-----Ursprungligt meddelande-----
Från: Peter Foti (PeterF) [mailto:PeterF@S...]
Skickat: den 2 april 2002 18:00
Till: ASP Databases
Ämne: [asp_databases] RE: Integers and values...argh.. =/
If the field is a text field in the database, you must surround it with
single quotes. If it's numeric, you must NOT surround it with quotes.
Change this line:
SQL = "SELECT * FROM Members WHERE id = '" & userid & "'"
to this:
SQL = "SELECT * FROM Members WHERE id = " & userid
Regards,
Pete
> -----Original Message-----
> From: SD-Studios [mailto:info@s...]
> Sent: Tuesday, April 02, 2002 10:11 AM
> To: ASP Databases
> Subject: [asp_databases] Integers and values...argh.. =/
>
>
> Hi!
> I've gotten this very simple, but a painintheass-error.
>
> Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
>
> [Microsoft][ODBC Microsoft Access Driver] Data type mismatch
> in criteria
> expression.
>
> /cdos/a_profile.asp, line 17
>
> What have I done wrong? Request.QueryString("id") is in this
> case an integer
> and the id-field in the database is the counter and
> key-thing.. =) Please
> help me out here!! Thanks!
> Here is my code and line 17 is objRS.Open SQL,objCon:
>
> userid = Request.QueryString("id")
> If userid = "" Then
> Response.Redirect "default.asp"
> End If
>
> Set objCon = Server.CreateObject("ADODB.Connection")
> Set objRS = Server.CreateObject("ADODB.Recordset")
>
> objCon.Open "Driver={Microsoft Access Driver (*.mdb)};dbq=" &
> Server.MapPath("db/db.mdb")
> SQL = "SELECT * FROM Members WHERE id = '" & userid & "'"
> objRS.Open SQL,objCon
>
> username = objRS("username")
> name = objRS("name")
> surname = objRS("surname")
> email = objRS("email")
> age = objRS("age")
> country = objRS("country")
> gender = objRS("gender")
> city = objRS("city")
> occupation = objRS("occupation")
> homepage = objRS("homepage")
> icq = objRS("icq")
> visits = objRS("visits")
> datum = objRS("date")
> lastvisit = objRS("date_time")
> --
> Martin Johansson,
> CEO & Project Supervisor
> SD-Studios
> +46 (0)70-3003320
> http://www.sd-studios.com
>
>
>