什么是""在查询什么意思? [英] What does the "?" mean in a query?

查看:204
本文介绍了什么是""在查询什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在下面的查询有哪些呢?是什么意思?



  this.AdminDelCmd.CommandText = 
DELETE FROM admin其中(admincd =?)AND(终端不是= ?);


解决方案

这是不是一个三元运算符,而不是可空类型的对象。



这就是所谓的参数化查询,用于帮助防止SQL注入。这是SQL语法的旧式。 (; SQL Server的如MySQL&)这可以在需要时查询与多个不同的数据库中。新的风格,也用于SQL服务器(AS指出下面我)使用@前面加上参数名称。 MySQL也使用@的服务器端用户变量声明这可能会导致一些混乱。



后来代码问号罢了。如果你能发布接下来的几行,这将有助于我们更加



下面是一些链接更彻底地解释事情(第二个是为ASP,但适用):< BR>
的http:// MSDN。 microsoft.com/en-us/library/cc296201(v=sql.90).aspx 结果
http://www.aspnet101.com/2007/03/parameterized-queries-in-asp-net/


In the following query, what does "?" mean?

this.AdminDelCmd.CommandText =
    "DELETE FROM Admin WHERE (admincd = ?) AND (terminalno = ?)";

解决方案

This is NOT a ternary operator, and is NOT an object of type Nullable.

This is called a parameterized query and is used to help prevent SQL Injection. This is the 'older style' of SQL syntax. This can be used when you want your queries to work with multiple different databases (such as MySQL & SQL Server). The new style, also used for SQL Server (as was pointed out to me below) uses a '@' prepended to the parameter name. MySQL also uses '@' for server-side user variable declarations which can cause some confusion.

Later code fills in the question marks. If you could post the next few lines, that would help us more.

Here are some links to explain things more thoroughly (the second is for asp but applies):
http://msdn.microsoft.com/en-us/library/cc296201(v=sql.90).aspx
http://www.aspnet101.com/2007/03/parameterized-queries-in-asp-net/

这篇关于什么是&QUOT;&QUOT;在查询什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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