Hi all..
First i would just like to say im a beginner at all this SQL stuff... BUT, i have a small prob. I am creating a login page in asp but am using a database so thats were the SQL come in. I need it to search the database and return the value 1 if the username is equal to the username in the database, and if the password is equal to the password from the database. I am getting the username and password of a form i have created.
The section of code i an having problems with is this:
<%
sSQL = "select 1 from users where username = '" & request("Username" & "' and password = '" & request("Password" & "'"
Set oConn = Server.CreateObject("ADODB.Connection"
oConn.Open "DSN=myDatabase"
oConn.execute sSQL
oConn.Close
Set oConn = Nothing
response.write(sSQL)'This is to see if the value of sSQL is actually = "1". Currently it is not as something is going wrong.
%>
How can i get the SQL to return the value 1 when the statement is true and make eighter the sSQL variable or any other variable equal to the one if the statement is true.
Thanks for any help
First i would just like to say im a beginner at all this SQL stuff... BUT, i have a small prob. I am creating a login page in asp but am using a database so thats were the SQL come in. I need it to search the database and return the value 1 if the username is equal to the username in the database, and if the password is equal to the password from the database. I am getting the username and password of a form i have created.
The section of code i an having problems with is this:
<%
sSQL = "select 1 from users where username = '" & request("Username" & "' and password = '" & request("Password" & "'"
Set oConn = Server.CreateObject("ADODB.Connection"
oConn.Open "DSN=myDatabase"
oConn.execute sSQL
oConn.Close
Set oConn = Nothing
response.write(sSQL)'This is to see if the value of sSQL is actually = "1". Currently it is not as something is going wrong.
%>
How can i get the SQL to return the value 1 when the statement is true and make eighter the sSQL variable or any other variable equal to the one if the statement is true.
Thanks for any help