I've had this problem many, many times. And it's always turned out to be a small typo or "" around an integer, but I just cannot find what's wrong with my SQL Statement this time!

SELECT Card_ID FROM Payment WHERE Customer_ID = 12 AND Card_Number = 1231231231231231

The table and fields are named correctly (the table is actually a query).

The only thing I can think of is the card number being too large, however it works fine in my INSERT INTO statement!
All of the fields are formatted as their respective data types, ie. Integers are set to integer, not string.

Any help is much appreciated!

Recommended Answers

All 7 Replies

Change column type to BigInt.

commented: Would have been required if I was using an integer, although the problem was caused by Card Number being stored as a string. +1

You mean to say this number 1231231231231231 is being stored in an integer field in the database ?

commented: I was string to store my Card Number, therefore without my single quotes on each side of the data, the SQL was invalid. +1

You mean to say this number 1231231231231231 is being stored in an integer field in the database ?

Ahh, I think I've just figured it out. It's stored as a String, therefore it needs quotes around my value! Thanks for the help!

Re: Related Article: Date Type Mismatch In criteria expression
i encounter that when i am building a code to update my record.. the problem of that is some of your field is empty value, specially fields that holding a currency value, and aside from that its maybe you have field like DATE, you should type it as, DATE1.VALUE.TOSHORTDATESTRING,

i hope this could help..

vb.net lover: jimbo

hey guys i have a problem here, what could be the problem of the error like this..
Overload resolution failed because no accessible 'Add' can be called with these arguments

any one can help me...

@aaliyahjim, you should have to create seperate thread (new article) and add necessary explanation with working (demo) code.

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.