Hello
I am trying to create a simple log-in page but I am getting three green 'underlines' on this line:
The errors are under
1)
(Used before assigned a value).
2)
(Used before assigned a value).
3)
(No 'As' clause, object assumed)
When I have tried to change 'ConnectionString' to 'conn', I just get other errors.
The page loads in my browser, but I would prefer tidy code. The rest of my code looks like this where the log-in form has two fields strEmail (Email field) and password (Password field):
Thank you.
I am trying to create a simple log-in page but I am getting three green 'underlines' on this line:
Code:
Dim sql As String = "SELECT * FROM university WHERE strEmail = '" & strEmail & "' AND [password] = '" & password & "'", ConnectionString
The errors are under
1)
Code:
& strEmail &
2)
Code:
& password &
3)
Code:
ConnectionString
When I have tried to change 'ConnectionString' to 'conn', I just get other errors.
The page loads in my browser, but I would prefer tidy code. The rest of my code looks like this where the log-in form has two fields strEmail (Email field) and password (Password field):
Code:
Using conn As OleDbConnection = New OleDbConnection(System.Configuration.ConfigurationManager.ConnectionStrings("students").ConnectionString)
Dim strEmail As String
Dim password As String
Dim sql As String = "SELECT * FROM university WHERE strEmail = '" & strEmail & "' AND [password] = '" & password & "'", conn
Dim cmd As New OleDbCommand(sql, conn)
conn.Open()
Dim dr As OleDbDataReader = cmd.ExecuteReader
Dim strEmailFound As Boolean = False
Dim passwordFound As Boolean = False
'if in database:
While dr.Read
strEmailFound = True
strEmail = dr("strEmail").ToString
passwordFound = True
password = dr("password").ToString
End While
conn.Close()
Thank you.