Hi, ihave a simple login page. This works fine, but what i need to do is store the userID that is being selected in the Stored Procedure so that i can use it throughout the rest if the system. The reason i need it is so when a user logs onto a new page, their name is displayed somewhere on the screen.
Does this look easily achievable from the above code? Any help on the matter i smuch apreciated...
Alex
VB.NET:
Public Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogin.Click
Dim sql = "SELECT UserID FROM tblUser WHERE LoginName='" & txtUserName.Text & "' AND LoginPassword='" & txtPassword.Text & "'"
Dim conn As OleDbConnection = carDba.getCn
Dim cmd As OleDbCommand
Dim userID As Integer
cmd = New OleDbCommand(sql, conn)
conn.Open()
Dim dr As OleDbDataReader = cmd.ExecuteReader
Try
If dr.Read = False Then
MessageBox.Show("Authentication failed...")
Else
MessageBox.Show("Login successfully...")
Dim main As New mdiCAR
With main
.WindowState = FormWindowState.Maximized
.ControlBox = True
.Show()
End With
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
conn.Close()
End Sub
Does this look easily achievable from the above code? Any help on the matter i smuch apreciated...
Alex