Login error :"The microsoft access database engine cannot find the input table Or ..

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:
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
 
Hello Sir,

Thanks ... I have added the table to database as well & also i can see it in database explorer..

Still getting such error.
 
Call GetSchema on your connection object and pass "TABLES" as the collection name. That will return information about the tables in that database. If 'Login_Users' is not there than that explains the error. If it is there then something strange is going on.

By the way, GetSchema returns a DataTable, so the easiest way to view the data is by assigning that DataTable to the DataSource property of a DataGridView.
 
Hello Sir,

Thank you so much for your help.
However i am unaware of what is getschema exactly.
It would really thankful if you can share any link or source code of doing it.
many thanks in advance sir.
 
So, what exactly is preventing you from searching for yourself?

Let me google that for you

It doesn't take any programming experience to be able to search the web.
 
Back
Top