calvin Posted January 24, 2005 Posted January 24, 2005 Hi, I get this error "datatype mismatch in criteria expression" in my sql query. One of datatype in my Acceess database is declare as "Number-Long Integer". This cause error occur while the datatype mismatch. I'm using asp.net with vbscript to code my page. In my sql query, there is a condition. CodeBehind: Dim strabc as (Integer/Long/Short/Single,Int32,Int64/Byte...)<- I had try all of this data type but still error! strabc = CType(textbox.text,Integer/...) Query = "Select * from table where abc = '" & strabc & "'" Microsoft Access Data Type: abc - Number-Long Integer It is easy to use if I declare abc in DB as "Text". IS ANYONE KNOW HOW TO SOLVE IT??? what should delare the variable in my code behind page?? Thank you very much Calvin Quote
Diesel Posted January 25, 2005 Posted January 25, 2005 Query = "Select * from table where abc = '" & strabc & "'" Take away the single quotes Query = "Select * from table where abc = " & strabc Dim strabc as Long You don't have to Ctype unless you have option strict on Quote
calvin Posted January 25, 2005 Author Posted January 25, 2005 Problem Solved The solution solved my problem. Thanks for your help :D Calvin Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.