i have make the simple code log in program with connect database.The below code have something problem.Can someone pro solve the problem.:(

Private Sub btnSignIn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSignIn.Click
Dim conn As New OleDb.OleDbConnection
Dim ds As New DataSet
Dim da As New OleDb.OleDbDataAdapter
Dim command As New OleDb.OleDbCommand

conn.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = C:\Documents and Settings\Prokiller\My Documents\Visual Studio Projects\in process\New Folder (2)22\username.mdb"

conn.Open()
        command.CommandText = "SELECT * FROM [UserName] WHERE TblUserName'" & txtUserName.Text & "' AND Pin= '" & txtPin.Text & "';"
        command.Connection = conn

da.SelectCommand = command
        da.Fill(ds, "username")

Dim count = ds.Tables(0).Rows.Count

 If count > 0 Then
            MsgBox("ok")
            Form2.Show()
            Me.Hide()
        Else
            MsgBox("invalid")

        End If

        conn.Close()
End Sub

command.CommandText = "SELECT * FROM [UserName] WHERE TblUserName='" & txtUserName.Text & "' AND Pin= '" & txtPin.Text & "';"

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.