Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

need help with login code

$
0
0
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

Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>