Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Log-in form errors

Status
Not open for further replies.

Blueie

Technical User
May 12, 2012
72
0
0
GB
Hello

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 &
(Used before assigned a value).
2)
Code:
& password &
(Used before assigned a value).
3)
Code:
ConnectionString
(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):

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.
 
When you hover over the green lines, what is it saying?
There are obviously not compilation errors, just warnings.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top