borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (when and how many times the application_onstart fire in asp.net ?)Next Topic (difference between web server control and html server control in asp.net?) New Topic New Poll Post Reply
AndreaVB Forum : VB.Net : trying to create a login form
Poster Message
bprego
Level: Guest


icon trying to create a login form

here is what i am working with right now:

varUser_Name, varPassword, varOperatorID are public variables
declares in a module. my query is not returning the operatorID.
thanks in advance for any help.

Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnLogin.Click
LoginSuccess = False
ValidateLogin()
If LoginSuccess = True Then
Dim formToOpen As frmAdmin
formToOpen = New frmAdmin
formToOpen.Show()
Me.Hide()
End If

End Sub

Public Sub ValidateLogin()
Dim oConn As SqlConnection = New SqlConnection
Dim oTable As DataTable = New DataTable
varUser_Name = txtUserName.Text
varPassword = txtPassword.Text
Try
oConn.ConnectionString = "my connection"
oConn.Open()
Dim oDA As SqlDataAdapter = New SqlDataAdapter("select
operator_ID from operator where (username ='" & varUser_Name & "'
and password = '" & varPassword & "'", oConn)
oDA.Fill(oTable)
oConn.Close()

Dim oRow As DataRow
For Each oRow In oTable.Rows
varOperatorID = CStr(oRow("OPERATOR_ID"))
Next
Catch e As Exception

If varOperatorID = 0 Then
LoginSuccess = False
MsgBox("Incorrect Login.",
MsgBoxStyle.OKOnly, "Login Error")
txtUserName.Text = ""
txtPassword.Text = ""
txtUserName.Focus()
Else
LoginSuccess = True
End If

Finally
If oConn.State = ConnectionState.Open Then
oConn.Close()
End If

End Try

End Sub

31-12-2003 at 03:08 PM
| Quote Reply
AndreaVB Forum : VB.Net : trying to create a login form
Previous Topic (when and how many times the application_onstart fire in asp.net ?)Next Topic (difference between web server control and html server control in asp.net?) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder