Can some one please tell me why I'm getting this error! I presume it is because there is something wrong with my Database connection but am not really sure what!
Thanks
...:: Error ::..
System.MissingMemberException: No default member found for type 'Boolean'.
...:: CODE ::..
Private Sub cmdSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSubmit.Click
If Page.IsValid Then
'Connect to Database for User Validation
If DBConnection(txtUserName.Text, txtPassword.Text) Then
FormsAuthentication.RedirectFromLoginPage(txtUserN ame.Text, False) ' ||||| default.aspx Page!
Else
' Credentials are Invalid
lblMessage.Text = "Invalid Login!"
End If
End If
End Sub
Function DBConnection()
Dim Myconn As New SqlConnection(ConfigurationSettings.AppSettings("s trConn"))
Dim cmd As New SqlCommand("ValidateUser", Myconn)
cmd.CommandType = CommandType.StoredProcedure
Dim objParam1, objParam2 As SqlParameter
objParam1 = cmd.Parameters.Add("@UserName", SqlDbType.Char)
objParam2 = cmd.Parameters.Add("@Password", SqlDbType.Char)
objParam1.Direction = ParameterDirection.Input
objParam2.Direction = ParameterDirection.Input
objParam1.Value = txtUserName.Text
objParam2.Value = txtPassword.Text
Try
If MyConn.State = ConnectionState.Closed Then
MyConn.Open()
End If
Dim objReader As SqlDataReader
objReader = cmd.ExecuteReader(CommandBehavior.CloseConnection)
While objReader.Read()
If CStr(objReader.GetValue(0)) <> "1" Then
lblMessage.Text = "Invalid Login!"
Else
objReader.Close()
Return True
End If
End While
Catch ex As Exception
lblMessage.Text = "Error Connecting to Database!"
End Try
End Function