Forum Moderators: open

Message Too Old, No Replies

insert/select

         

stevelibby

1:58 pm on Mar 11, 2005 (gmt 0)

10+ Year Member



hi all i am totally stuck as a newbie.
i have just created a form which collects login user and pass. On submit the data is put into a db table si can log entries, that works fine, but i now want to query it against another table, and if the conditon is met then enter. i have read lots but cant get this next bit.

connectionion string
<%
variable1 = Request.form("UserName")
variable2 = Request.form("Password")
variable3 = Request.ServerVariables("remote_addr")
If Trim(variable1) <> "" Then
%>
<%
DIM mySQL, objRS
mySQL = "INSERT INTO login(UserName, Password, Time, Date, IPaddress) VALUES ('" & variable1 & "','" & variable2 & "','" & Time() & "','" & Date() & "','" & variable3 & "');"
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open mySQL, objConn
End If
%>
what do i do?

syber

7:43 pm on Mar 12, 2005 (gmt 0)

10+ Year Member



I think you have too many ampersands in your mySQL string. The best way to find out is to do a Response.Write followed by a Response.End before the Set statement -

mySQL = "INSERT INTO login(UserName, Password, Time, Date, IPaddress) VALUES ('" & variable1 & "','" & variable2 & "','" & Time() & "','" & Date() & "','" & variable3 & "');"
Response.Write
Response.End
'Set objRS = Server.CreateObject("ADODB.Recordset")
'objRS.Open mySQL, objConn
End If

This way you will be able to see what actually was loaded into mySQL