hi guys..

i always got this error in vb6..
here's my code

'########### Variable declaration ###########
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset

'########### Variable initialization ###########
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset

strUserName = txtUserName.Text
strPassWord = txtPassWord.Text

connStringSQL = "MySQL ODBC 5.1 Driver; SERVER=localhost; DATABASE=cpalms; UID=root; PWD=; DSN=CPALMS;"conn.CursorLocation = adUseClient
conn.Open connStringSQL

strSQL = "SELECT * FROM userData WHERE username = '" & strUserName & "'"
    rs.Open strSQL, conn, adOpenDynamic, adLockOptimistic
        
   '########### Check if record exists ###########
    If rs.RecordCount = 0 Then                  ' the error displays in here..
        MsgBox "Username " & strUserName & " does not exist!", vbCritical + vbOKOnly
        txtUserName.SetFocus
        Call Form_Load

i would really appreciate if you could help me regarding this..
this code works fine with my computer at home, but in the office it does not..
i installed mysql 5 and vb6..the services are running smoothly..

thank you very much ^^

Recommended Answers

All 2 Replies

Try inserting some dummy data from back end and recheck.

Also you need to handle NULL properly.

hI,
Me also getting same error.
can you pleae help me.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.