Results 1 to 2 of 2

Thread: What is wrong with this?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2001
    Posts
    759
    Hi Everyone,

    What is wrong with this bit of code? I keep getting a data type mismatch in criteria expression error.

    Code:
    rsVendors.Open "SELECT * FROM Vendors WHERE VendorID = '" & txtMemberID.Text & "'", _
            conn, adOpenStatic, adLockOptimistic

    I think the error is coming from the txtMemberID.Text text box which is being filled by ADO from the Members table. This field is an autonumber field. Why is this SQL statement not working? I would appreciate any help. Thank you.

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    VendorID is probably a number and you are using it as a string. Take out the single quotes.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width