asp.net中, 在sql语句中 ' "++" '和"++"有什么区别啊
解决方案 »
- 关于.NET运用模板的问题?
- 如何使页面自动适应Gridview控件大小?
- 从服务端获得时间,然后在客户端保持时间更新 .net 如何写
- 模式窗体的显示
- 问个问题: .ascx的文件用什么可以打开?
- 动态添加FildUpLoad控件的问题!请高手赐教!!
- Page_PreInit()是哪里来的?为什么会执行?
- 请问DropDownList从数据库取数据,第一个数据显示不出来,怎么解决呢?
- 陕北吴旗娃进来看看:AspNetPager7.1的 url 重写分页问题
- asp.net的代码和页面代码分离,哪个客户端的验证应该发在哪?能给点代码??
- 帮我看看这2个是神马问题
- 请推荐一个基于net的CMS系统,谢谢
比如select * from tb where userName='licai1210'这是第一个的,
第二个的是这样的select * from tb where userName=licai1210这样就明显报错了
这时候需要查询sql就是 string sql="select * from table where username='"+name+"'";
这样就查到所有username='haha'的
如果string sql ="select * from table where username='name'";
那么查到的就是所有username='name'的
name为字符串或数字都可以这么写
string sql="select * from table where username='"+name+"'";
下面这么写name 只能是数字类型
string sql="select * from table where username='"+name+"'";