12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
ADADADADAD
网络知识 时间:2024-12-03 15:10:09
作者:文/会员上传
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
使用参数化查询语句进行查询的示例:string Account =Request.Form["Account"]; string sql = "select id,Name,Account from User where Account = @Account";SqlParameter[]
以下为本文的正文内容,内容仅供参考!本站为公益性网站,复制本文以及下载DOC文档全部免费。
使用参数化查询语句进行查询的示例:
string Account =Request.Form["Account"];
string sql = "select id,Name,Account from User where Account = @Account";
SqlParameter[] values = new SqlParameter[] { //参数化查询, 防止sql注入
new SqlParameter("@Account",Account),
};
DataTable datatable = DBHelper.GetDataTable(sql, values);
//把用户传到后台的账号Account赋值给@Account,这样数据库服务器不会将参数的内容视为SQL指令来处理,而是在数据库完成SQL指令的编译后,才套用参数运行,从而防止SQL注入。
11-20
11-19
11-20
11-20
11-20
11-19
11-20
11-20
11-19
11-20
11-19
11-19
11-19
11-19
11-19
11-19