Dim myconnection As OleDbConnection = New OleDbConnection()
myconnection.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=c:\AccessDatabase.mdb"
myconnection.Open()
Dim sqlStatement As String
sqlStatement = "insert into Table_User(UserId,UserPassword) values(TextBoxUser.text ,TextBoxPassword.text)"
Dim mycommand As OleDb.OleDbCommand
mycommand = New OleDb.OleDbCommand(sqlStatement, myconnection)
mycommand.ExecuteNonQuery()
myconnection.Close()
Dim myconnection As OleDbConnection = New OleDbConnection()
myconnection.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=c:\AccessDatabase.mdb"
myconnection.Open()
Dim sqlstatement As String
Dim numrows As Integer
sqlstatement = "select * from Table_User where UserId= '" & TextBoxUser.Text & "' and UserPassword = '" & TextBoxPassword.Text & "' "
Dim mycommand As OleDb.OleDbCommand
mycommand = New OleDb.OleDbCommand(sqlstatement, myconnection)
numrows = mycommand.ExecuteScalar()
If numrows > 0 Then
MessageBox.Show(TextBoxUser.Text)
End If
myconnection.Close()