You are on page 1of 1

Dim uname As String = " "

Dim pword As String


Dim username As String = " "
Dim pass as String
If TextBox1. Text = " " Or TextBox2.Text = " " Then
MsgBox("Please Fill All the info")
Else
uname = TextBox1. Text
pword = TextBOx2. Text
Dim querry As String = "Select password From Table1 where name= '" &
uname & " ' ; "
Dim dbsource As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=C :\Users\win8\Documents\Database3.accdb"
Dim conn = New OleDbConnection (dbsource)
Dim cmd As New OleDbCommand (querry, conn)
conn . Open()
Try
pass = cmd.ExecuteScalar () . ToString
Catch ex As Exception
MsgBox("Username does not exit")
End Try
If ( pword = pass ) Then
MsgBox("Login success")
Form2. Show()
If Form2.Visible Then
Me . Hide()
End If
Else
MsgBox("login Failed")
TextBox1.Clear()
TextBox2.Clear()
End If
End If

If TextBox2.Text = " " Or TextBox2.Text = " " Or TextBox3.Text = " " Then
MsgBox("please fill the info")
Else
Try
Dim conn As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=C:\Users\win8\Documents\Database3.accdb;")
Dim insert As String = "Insert into Table1 values(' " & TextBox1.Text &
" " , " " & TextBox2.Text & " ') ; "
Dim cmd As New OleDbCommand (insert, conn)
conn.Open()
Catch ex As Exception
MsgBox("error")
End Try
End If

You might also like