上篇博客写了关于重构代码用到的SQLHelper类,这个类包括四种函数,根据是否含参和是否有返回值各分两种.在这里写写传参过程用到的SqlParameter. 如果我们使用如下拼接sql字符串的方式进行数据库操作存在脚本注入的危险: Dim sql As String = "insert into T_Loginlog(userID,loginDate,loginTime,computer)values('" + Enloginlog.user_userID + "','&q
对于sql语句中一个@的参数@au_id,在sqlParameter中,可以用@au_id,也可以用au_id. 要是bt点的,用两个@,你就不能随便省略@了. 对于sql语句 : select * from authors where au_id=@@au_id在SqlParameter中,也只能用@@au_id,而不能是@au_id,或au_id.
List<SqlParameter> paras = new List<SqlParameter>(); paras.Add(new SqlParameter("@mi_id", mid)); if (state!="") { sql += " and mi_state=@state "; paras.Add(new SqlParameter("@state", state)); } if (categ
MVC 5 调用存储过程参数配置方法-Procedure or function 'UP_***' expects parameter '@****', which was not supplied. 通过Database.SqlQuery调用SQL2016的存储过程,传入参数,返回结果集合.总是报如下错误 Msg 201, Level 16, State 4, Procedure UP_***, Line 0 [Batch Start Line 15]Procedure or function
一,微软SQLHelper.cs类 中文版: using System; using System.Data; using System.Xml; using System.Data.SqlClient; using System.Collections; namespace Classbao.Data { /// <summary> /// SqlServer数据访问帮助类 /// </summary> public sealed partial class SqlHelper
using System; using System.Data; using System.Xml; using System.Data.SqlClient; using System.Collections; using System.Configuration; namespace BookDAL { /// <summary> /// SqlServer数据访问帮助类 /// </summary> public sealed class SqlHelper { #region
一.数据库 /*==============================================================*/ /* DBMS name: Microsoft SQL Server 2000 */ /*==============================================================*/ if exists (select 1 from sy
using System; using System.Data; using System.Xml; using System.Data.SqlClient; using System.Collections; using System.Configuration; namespace BookDAL { /// <summary> /// SqlServer数据访问帮助类 /// </summary> public sealed class SqlHelper { #region