标签:
//调用:
public DataSet GetPageList2005(string SelectList,string TableSource,int PageSize,int PageIndex,stringstrWhere,string OrderExpression,refint TotalRecord)
{
SqlParameter[] parameters = {
DbHelperSQL.AddInParameter("@ReFieldsStr",SelectList,SqlDbType.VarChar,200),
DbHelperSQL.AddInParameter("@TableName", TableSource, SqlDbType.VarChar,50),
DbHelperSQL.AddInParameter("@WhereString",strWhere,SqlDbType.VarChar,500),
DbHelperSQL.AddInParameter("@OrderString", OrderExpression,SqlDbType.VarChar,200),
DbHelperSQL.AddInParameter("@PageSize",PageSize,SqlDbType.Int),
DbHelperSQL.AddInParameter("@PageIndex",PageIndex,SqlDbType.Int),
DbHelperSQL.AddOutParameter("@TotalRecord",SqlDbType.Int)
};
DataSet tmpds = DbHelperSQL.RunProcedure("GetPageList2005", parameters, "ds_"+ TableSource);
TotalRecord =int.Parse(parameters[6].Value.ToString());
return tmpds;
}
另一种:
SqlParameter[] params = new SqlParameter[] {
new SqlParameter("@a", a),
string.IsNullOrEmpty(b)? new SqlParameter("@b", DBNull.Value) : new SqlParameter("@b", b)
};
另一种:
List<SqlParameter> list= new List<SqlParameter>();
list.Add(new SqlParameter("@Param1", a));
list.Add(new SqlParameter("@Param2", b));
list.Add(new SqlParameter("@Param3", string.IsNullOrEmpty(c)?(object)DBNull.Value:c ));
SqlParameter[] Params = list.ToArray();
标签:
原文地址:http://www.cnblogs.com/AnnyGird-LiMing/p/5016902.html