Simple ASP MYSQL question

Simple ASP MYSQL question

am 30.04.2007 16:56:31 von lawrence.hunt

Hey

I have successfully been able to read from a MYSQL database using
this:

set rs = conn.Execute("SELECT Password FROM UserTable WHERE Username =
'" & entuser & "' AND Password = '" & entpass & "'")

Do while not rs.eof ' Do until it reaches end of db
actualpass = rs("Password")
rs.MoveNext ' Next record
loop


But I now want to be able to add new records to tables, I used this
code, but it does not seem to be able to work, any ideas?

set rs = conn.Execute("INSERT INTO UserTable SET Username = '" &
username & "' AND Password = '" & username & "' AND FirstName = '" &
username & "' AND LastName = '" & username & "' AND Email = '" &
username & "' AND confirm = 0 AND confstring = '" & passconf & "'")

Re: Simple ASP MYSQL question

am 30.04.2007 17:08:27 von exjxw.hannivoort

Lawrence wrote on 30 apr 2007 in microsoft.public.inetserver.asp.general:

> set rs = conn.Execute("INSERT INTO UserTable SET Username = '" &
> username & "' AND Password = '" & username & "' AND FirstName = '" &
> username & "' AND LastName = '" & username & "' AND Email = '" &
> username & "' AND confirm = 0 AND confstring = '" & passconf & "'")
>

I am not a mySql specialist, but the AND's seem faulty.

Try something like:

SQL="INSERT INTO UserTable (Password , FirstName , LastName )"&_
"VALUES ('" & pw & "','" & fn & "','" & ln & "')"
response.write SQL
response.end
' remark these 2 lines above when you are satisfied with the result
set rs = conn.Execute(SQL)

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)