I have created 1 login form.
I have used the MS ACCESS database as backend tool.
Table Name : UserAccount
Fields : • username • password
I written the code as below ...
Button1=Login button
There is no error in this code, but when I run this form, and enter the right username and password, then also it displays the magbox "Not Accessed". What can I do about this?
I have used the MS ACCESS database as backend tool.
Table Name : UserAccount
Fields : • username • password
I written the code as below ...
Button1=Login button
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim con As New OleDbConnection("Provider=microsoft.jet.oledb.4.0 ; Data Source=E:\Brinda & Jay\Brinda\02 S.Y\VB.NET\My Project\Project.mdb")
con.Open()
qry = "select count(id) from UserAccount where username= ' " & txtUserName.Text & " ' and password= ' " & txtPassword.Text & " ' ;"
Dim cmd As New OleDbCommand(qry, con)
Dim da As New OleDbDataAdapter(cmd)
ans = cmd.ExecuteScalar()
If ans > 0 Then
MsgBox("Accessed")
Else
MsgBox("Not Accessed")
End If
con.Close()
End Sub
Comment