Click here to Skip to main content
16,021,112 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Can anyone modify this Query in syntax error:
string Num;//i.e 8555
String Pass;//i.e 565
cnt is my table;
Command.CommandText = "SELECT * FROM cnt WHERE (Number=\'" + Num + " \') AND (Pass=\'" +Pas+ " \');";
Posted
Updated 21-Oct-10 6:41am
v2

You misspelled "Pass" where you're doing thies :

"...'" + Pas + "'..."


It should be:

"...'" + Pass + "'..."


Visual Studio comes with a debugger. Use it.
 
Share this answer
 
v2
Try:
Command.CommandText = "SELECT * FROM cnt WHERE (Number=" + Num + " AND Pass='" +Pas+ "');"; 
.
 
Share this answer
 
You are using a number which should not have '' around it. Remove the '' and things should be fine.
 
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