Click here to Skip to main content
15,892,804 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, Iam using vs2010 and access table. I wish to have a Select Query with integer values.
But Iam receiving error as "DataType Mismatch" error. Does anybody can show me a correct one?
Because after long gap Iam using Access Table...

My Codes
C#
SvINVNo = 0;
SvINVNo = Convert.ToInt32(richTextBox1.Text);
String SelctInvQury = "Select * from invoicemst where invoice_no= ' "&SvINVNo &" '";

Thank you
Posted

Try the following :
C#
String SelctInvQury = "Select * from invoicemst where invoice_no= " & SvINVNo ;
 
Share this answer
 
What Solution 1 was telling you is don't put single quotes around an integer. Then it is treated like a string if you do. Especially because the way you had it was also putting a space on either side of the integer and then treating that as a string.
 
Share this answer
 
String SelctInvQury = string.Format("Select * from invoicemst where invoice_no= {0} ", SvINVNo);

Found the answer
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900