0

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

Edited by __avd: Added [code] tags. For easy readability, always wrap programming code within posts in [code] (code blocks).

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by GeekByChoiCe
0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.