SqlParameter
转自:
1 SqlParameter[] parameters =...{ new SqlParameter("@tblName",SqlDbType.NVarChar,200),
2 new SqlParameter("@fldName",SqlDbType.NVarChar,500),
3 new SqlParameter("@pageSize",SqlDbType.Int),
4 new SqlParameter("@page",SqlDbType.Int),
5 new SqlParameter("@fldSort",SqlDbType.NVarChar,200),
6 new SqlParameter("@Sort",SqlDbType.Bit),
7 new SqlParameter("@strCondition",SqlDbType.NVarChar,1000),
8 new SqlParameter("@ID",SqlDbType.NVarChar,150),
9 new SqlParameter("@Dist",SqlDbType.Bit),
10 new SqlParameter("@pageCount",SqlDbType.Int),
11 new SqlParameter("@Counts",SqlDbType.Int),
12 new SqlParameter("@strSql",SqlDbType.NVarChar,1000)};
13 parameters[0].Value = tblName;
14 parameters[1].Value = (fldName == null) ? "*" : fldName;
15 parameters[2].Value = (pageSize == 0) ? int.Parse(ConfigurationManager.AppSettings["PageSize"]) : pageSize;
16 parameters[3].Value = pageIndex;
17 parameters[4].Value = fldSort;
18 parameters[5].Value = Sort;
19 parameters[6].Value = strCondition == null ? "" : strCondition;
20 parameters[7].Value = ID;
21 parameters[8].Value = Dist;
22 parameters[9].Direction = ParameterDirection.Output;
23 parameters[10].Direction = ParameterDirection.Output;
24 parameters[11].Direction = ParameterDirection.Output;
25 DataSet ds = RunProcedure(connectionString, "PageList", parameters, "ds");
SqlParameter[] paraList = new SqlParameter[7];
paraList[0] = new SqlParameter( "@userName ", SqlDbType.VarChar, 50);
paraList[0].Value = personModel.UserName;
paraList[1] = new SqlParameter( "@account ", SqlDbType.VarChar, 100);
paraList[1].Value = personModel.Account;
paraList[2] = new SqlParameter( "@pwd ", SqlDbType.VarChar, 100);
paraList[2].Value = personModel.Pwd;
paraList[3] = new SqlParameter( "@unitID ", SqlDbType.VarChar, 20);
paraList[3].Value = personModel.UnitID;
paraList[4] = new SqlParameter( "@email ", SqlDbType.VarChar, 100);
paraList[4].Value = personModel.Email;
paraList[5] = new SqlParameter( "@officeTel ", SqlDbType.VarChar, 20);
paraList[5].Value = personModel.OfficeTel;
paraList[6] = new SqlParameter( "@mobile ", SqlDbType.VarChar, 20);
paraList[6].Value = personModel.Mobile;
return sd.ExecuteNonQuery( "UP_Person_ADD ", paraList);