Professional Documents
Culture Documents
SqlClient
Public Class LogIn
Dim sqlclasslib As New connectionlibrary
Public Sub sqldata()
Dim sqlReader As SqlDataReader
sqlReader = sqlcom.ExecuteReader
If sqlReader.HasRows = 0 Then
MsgBox("No match found!", MsgBoxStyle.Information, "ARMMC Hospital
Management System")
txtUsername.Focus()
txtPassword.Clear()
txtUsername.Clear()
cmbUsertype.Text = ""
End If
While sqlReader.Read
If Trim(txtUsername.Text) = sqlReader.Item("Username") And
Trim(txtPassword.Text) = sqlReader.Item("Password") And cmbUsertype.Text =
sqlReader.Item("Usertype") Then
'If objDataReader.Item("Access") = "Maintenance" Then
' MsgBox("Welcome " + txtUsername.Text + "!",
MsgBoxStyle.Information, "ARMMC Hospital Management System")
'Else
' MsgBox("Welcome " + txtuser.Text + "!",
MsgBoxStyle.Information, "COOlegium Guide")
' MainParent.MaintenanceToolStripMenuItem.Enabled = False
' MainParent.Show()
' Me.Hide()
' txtpass.Clear()
' txtuser.Clear()
'End If
Me.Hide()
MainMenu.Show()
End If
End While
End Sub
End If
sqlclasslib.initializeCommand(strSQL)
sqlclasslib.addParameter("@Username", SqlDbType.VarChar,
txtUsername.TextLength, Trim(txtUsername.Text))
sqlclasslib.addParameter("@Password", SqlDbType.VarChar,
txtPassword.TextLength, Trim(txtPassword.Text))
sqlclasslib.addParameter("@Usertype", SqlDbType.VarChar,
Val(cmbUsertype.ToString), Trim(cmbUsertype.Text))
sqldata()
End Sub
End Class