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 (Accessing File Atributes)Next Topic (How to output data on the printer port?) New Topic New Poll Post Reply
AndreaVB Forum : VB General : working with database in VB
Poster Message
sahrul
Level: Guest


icon working with database in VB  Archived to Disk

Hi,

I face some problem during connecting my project with databse.  The formula is as below:-

Private Sub cmdFindEmployee_Click()

    passno = Text4.Text

        Set db = CreateObject("ADODB.Connection")
            db.Open "database1"
                arahanSQL = "SELECT * FROM dataA WHERE PassNo = ' " + passno + " ' "
                Set rs = db.Execute(arahanSQL)
    If rs.EOF Then
        MsgBox "Data is not in the system!!", vbExclamation + vbOKOnly, "FIND"
        Text4.Text = ""
        Text4.SetFocus
        Else
        dbname = rs("Name")
        dbbasic = rs("Basic")
    
        Text1.Text = dbname
        txtBasicSalary.Text = Format(dbbasic, AMOUNT)
        db.Close
    
        Text1.BackColor = &HC0FFFF
        
    End If
End Sub

but when I run it message "ODBC data connection mismatch in criteria expression".

what is the problem actually?


[Edited by admin on 18-07-2002 at 08:24 AM GMT]

18-07-2002 at 06:51 AM
| Quote Reply
Coyote
Level: Guest

icon Re: working with database in VB  Archived to Disk

Revise your SQL statement as follows:

arahanSQL = "SELECT * FROM dataA where PassNo = " & "'" & passno & "'"

Hope this helps...
Coyote

18-07-2002 at 12:32 PM
| Quote Reply
AndreaVB Forum : VB General : working with database in VB
Previous Topic (Accessing File Atributes)Next Topic (How to output data on the printer port?) 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