HI I have vb.net with ms access database application.
I want to create log in form
Here is my code but when enter the details and hit Login button it says"datatype mismatch error"

Dim con As New OleDbConnection
        Dim cmd As New OleDbCommand
        Dim rd As OleDbDataReader
        con.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\data\Histopathology New.accdb"
        cmd.Connection = con
        con.Open()
        cmd.CommandText = "select login, password from autho where login= '" & TextBox1.Text & "' and password= '" & TextBox2.Text & "'"
        rd = cmd.ExecuteReader()
        If rd.HasRows Then
            Welcome.Show()
        Else
            MsgBox("Invaid")
        End If

what is datatype for login field and password field in your database?

its username & password

why not use

cmd.CommandText = "select from autho where login= '" & TextBox1.Text & "' and password= '" & TextBox2.Text & "'"

just like that.

ok....Let me try on this

Hey all worked fine. Thanks

glad to know

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.