Loading

help on my code please!

1 post / 0 new
renz09's picture
Offline
Joined: 10/24/2009
help on my code please!

I use Microsoft Activex Data Object 2.8 Library

here is my code!

module...
Public conConnection As New ADODB.Connection
Public rsRecord As New ADODB.Recordset

Public Sub DBConnection()
conConnection.Open
Set conConnection = New ADODB.Connection
conConnection.CursorLocation = adUseClient

conConnection.Open "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = " & App.Path & "\database\guidance.mdb"

End Sub

Login Button

f Text1.Text = "" Then
MsgBox "Please Enter Account!", vbCritical, "Error"
Text1.Text = ""
Text2.Text = ""
Exit Sub
End If

DBConnection
Set rsRecord = New ADODB.Recordset
rsRecord.Open "Select * from User where Username = '" & Text1.Text & "' And Password = '" & Text2.Text & "'", conConnection, adOpenForwardOnly, adLockOptimistic
'
If Text1.Text = " & Username & " And Text2.Text = " & Password & " Then
MsgBox "Login Succeeded!", vbInformation + vbOKOnly, "Successfully Login!"
'Shell "Main", vbNormalFocus

Else
MsgBox "Username:" & Text1.Text & " and Password did not match any records from DataBase!", vbCritical, "Error"
Text1.Text = ""
Text2.Text = ""
End If

'close the recordset
rsRecord.Close: Set rsRecord = Nothing
'close the connection
conConnection.Close: Set conConnection = Nothing
End Sub

tnx in advance!

Add new comment

Filtered HTML

  • You may insert videos with [video:URL]
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <asp>, <c>, <cpp>, <csharp>, <css>, <html4strict>, <java>, <javascript>, <mysql>, <php>, <python>, <sql>, <vb>, <vbnet>. The supported tag styles are: <foo>, [foo].
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.