C#(查询)... [英] C#(Query)...

查看:66
本文介绍了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.


这篇关于C#(查询)...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆