VB Code:
SQL = "Select 1 " & _
"From register " & _
"Where username='" & sUsername & "' " & _
"And password = '" & sPassword & "'"
'ConnObject is you connection to the database
rs.open SQL, ConnObject, adOpenStatic, adLockReadOnly
'If no records returned then the login failed
If rs.recordcount = 0 then
MsgBox "Login Attemp Failed."
Exit Sub
'Login was successfull
Else
'Continue w/ processing
End If
VB Code:
Dim conn as Connection
Dim ConnStr as String
ConnStr = "Provider=SQLOLEDB;Server=YourServer;"
ConnStr = ConnStr & "Database=YourDatabase;UID=" & sUserName
ConnStr = ConnStr & ";PWD=" & sPassword
set conn = new connection
On Error Goto ErrHandler
Conn.Open connStr
Exit Sub
ErrHandler:
If Err = -2147217843 Then
msgbox "Verify UserName and Password"
exit sub
End If