.net简单的三层实现功能(3)
来源:未知 责任编辑:责任编辑 发表时间:2015-09-16 20:04 点击:次
42 command.CommandText = commandText;
43 command.CommandType = CommandType.Text;
44 return command;
45 }
46
47 /// <summary>
48 /// GetParameter 用于为命令设置参数
49 /// </summary>
50 /// <param name="paramName"></param>
51 /// <param name="paramValue"></param>
52 /// <param name="command"></param>
53 /// <returns></returns>
54 private static DbParameter GetParameter(string paramName, object paramValue, DbCommand command)
55 {
56 DbParameter parameter = command.CreateParameter();
57 parameter.ParameterName = paramName;
58 parameter.Value = paramValue;
59 return parameter;
60 }
61
62 /// <summary>
63 /// 执行无参的存储过程
64 /// </summary>
65 /// <param name="sqlCommand">存储过程名</param>
66 /// <returns></returns>
67 public static int ExecuteNonQueryProc(string sqlCommand)
68 {
69 int result = 0;
70 using (DbConnection connection = GetConnection())
71 {
72 DbCommand command = GetCommand(sqlCommand, CommandType.StoredProcedure, connection);
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>