|
-
Dec 16th, 2003, 08:02 AM
#3
Thread Starter
New Member
Thanks for the help, but I don't follow....
What does ExecuteScalar mean?
This is my code so far....
Sub SeeIfUserExists()
Dim ConnectionString As String = _
"Provider=Microsoft.Jet.OLEDB.4.0;data source=" & _
server.mappath("database/BikeBits.mdb")
Dim strSQL as String = ("SELECT * from tblUsers where CustomerCode = '" & txtboxCustomerCode.Text & "' and Password = '" & txtboxPassword.Text &"'")
Dim objConnection as New OledbConnection(ConnectionString)
Dim objCommand as New OleDbCommand(strSQL, objConnection)
Dim objDataReader as OleDbDataReader
try
objConnection.open
objDataReader = objCommand.ExecuteReader()
if objDataReader.Read()=True Then
'do this if record found
Session("Username") = txtboxCustomerCode.Text
Session("LoggedIn") = "Yes"
Response.redirect("mainmenu.aspx")
else
'record doesn't exist, so do this....
objDataReader.Close()
objConnection.Close()
lblError.Text="User not found!"
end if
objDataReader.Close()
objConnection.Close()
catch e as Exception
' con_open.text="Connection failed to open"
' con_close.text=e.ToString
end try
End Sub
Last edited by HELLO.JPG; Dec 16th, 2003 at 04:16 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|