I am working on a login page for an asp.net application. I’m making my own login and everything is working so far: I get a connection, the query is asking to return Count from the table where the username and password match the username password in the table.
The problem occurs here:
intResult = DirectCast(cmd.ExecuteScalar(), Integer)
I get the error: Invalid Column name "MemberLogin" "MemberPassword"
Here is the pertinent code:
Dim strSQLQuery As String
strSQLQuery = "SELECT Count(*) WHERE [MemberLogin] = @MemberLogin And [MemberPassword] = @MemberPassword"
Dim intResult As Integer = 0
Dim cmd As New SqlCommand(strSQLQuery, sqlConnection)
cmd.Parameters.AddWithValue("@MemberLogin", txtUsername.Text)
cmd.Parameters.AddWithValue("@MemberPassword", txtPassword.Text)
sqlConnection.Open()
intResult = DirectCast(cmd.ExecuteScalar(), Integer)
If intResult > 0 Then
Return True
End If
sqlConnection.Close()
You are missing your
FROMclauseFROM yourTable needs to go here