C#(查询)...
问题描述:
任何人都可以在语法错误中修改此查询:
字符串Num;//即8555
字符串通行证;//即565
cnt是我的桌子; Command.CommandText = "SELECT * FROM cnt WHERE (Number=\''" + Num + " \'') AND (Pass=\''" +Pas+ " \'');";
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+ " \'');";
答
您在做Thies时拼错了"Pass":
You misspelled "Pass" where you''re doing thies :
"...''" + Pas + "''..."
应该是:
It should be:
"...''" + Pass + "''..."
Visual Studio带有调试器.使用它.
Visual Studio comes with a debugger. Use it.
尝试:
Command.CommandText = "SELECT * FROM cnt WHERE (Number=" + Num + " AND Pass=''" +Pas+ "'');";
.
您使用的数字周围不应带有''.删除",一切正常.
You are using a number which should not have '''' around it. Remove the '''' and things should be fine.