Lovelysingh
New member
- Joined
- Jun 27, 2013
- Messages
- 3
- Programming Experience
- Beginner
Login error :"The microsoft access database engine cannot find the input table Or ..
Hello All,
I am very new to vb, Hence i m facing a small challenge with the code,
I have a login form where the user enters the name and password, for this i have entered a ready usernames and password in access table,
Now i m mapping the same username and password from the access table Login_Users.
However i feel there is an small issue, which i am making mistake.
I am getting the error as "The microsoft access database engine cannot find the input table or query 'Login_Users'. make sure it exists and that its name is spelled correctly"
However i have made sure the spells is entered correctly.
Here is the code:
Hello All,
I am very new to vb, Hence i m facing a small challenge with the code,
I have a login form where the user enters the name and password, for this i have entered a ready usernames and password in access table,
Now i m mapping the same username and password from the access table Login_Users.
However i feel there is an small issue, which i am making mistake.
I am getting the error as "The microsoft access database engine cannot find the input table or query 'Login_Users'. make sure it exists and that its name is spelled correctly"
However i have made sure the spells is entered correctly.
Here is the code:
VB.NET:
Imports System.Data.OleDbPublic Class Login
Public Connstring As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\SAMI.accdb"
Public Conn As New OleDbConnection
Private Sub Login_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Conn.ConnectionString = Connstring
If Conn.State = ConnectionState.Closed Then
Conn.Open()
MsgBox("Connection Closed, Connectiong......")
Else
MsgBox("Connection already open")
End If
End Sub
Private Sub BtnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnLogin.Click
Dim SqlQuery As String = "Select * From Login_Users Where Username = @cmbUsername and Password = @txtpassword"
Dim SqlCommand As New OleDbCommand
Dim Sqlrdr As OleDbDataReader
Try
With SqlCommand
.CommandText = SqlQuery
.Connection = Conn
.Parameters.AddWithValue("@filed1", CmbUsername.Text)
.Parameters.AddWithValue("@filed2", TxtPassword.Text)
.ExecuteNonQuery()
End With
Sqlrdr = SqlCommand.ExecuteReader
If (Sqlrdr.Read()) Then
MsgBox("Authentication Successful")
Me.CmbUsername.Text = My.Forms.Summary.TextBox1.Text
Summary.Show()
Else
MsgBox("Please enter valid Username or Password")
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub