this is the code i got to start with where i have a form with a user name and password on it a few things i need to be able to do which are when the user logs in i depending on who logs in depends on which form opens
Dim connection As New SqlClient.SqlConnection
Dim command As New SqlClient.SqlCommand
Dim adaptor As New SqlClient.SqlDataAdapter
Dim dataset As New DataSet
connection.ConnectionString = ("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Cinema.mdf;Integrated Security=True;User Instance=True")
command.CommandText = "SELECT * FROM [Users] WHERE FirstName= ' " & txtUserName.Text & "'AND Password='" & txtPassword.Text & "';"
connection.Open()
command.Connection = connection
adaptor.SelectCommand = command
adaptor.Fill(dataset, "0")
Dim count = dataset.Tables(0).Rows.Count
If count > 0 Then
MainMenu.Show()
Me.Hide()
Else
MsgBox("Either your UserName or Password are incorrect or you are not Authorized to login")
End If
i also need to record the user who is loged in
can any one help
Dim connection As New SqlClient.SqlConnection
Dim command As New SqlClient.SqlCommand
Dim adaptor As New SqlClient.SqlDataAdapter
Dim dataset As New DataSet
connection.ConnectionString = ("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Cinema.mdf;Integrated Security=True;User Instance=True")
command.CommandText = "SELECT * FROM [Users] WHERE FirstName= ' " & txtUserName.Text & "'AND Password='" & txtPassword.Text & "';"
connection.Open()
command.Connection = connection
adaptor.SelectCommand = command
adaptor.Fill(dataset, "0")
Dim count = dataset.Tables(0).Rows.Count
If count > 0 Then
MainMenu.Show()
Me.Hide()
Else
MsgBox("Either your UserName or Password are incorrect or you are not Authorized to login")
End If
i also need to record the user who is loged in
can any one help