.net简单的三层实现功能(4)
来源:未知 责任编辑:责任编辑 发表时间:2015-09-16 20:04 点击:次
73 connection.Open();
74 result = command.ExecuteNonQuery();
75 command.Parameters.Clear();
76 }
77 return result;
78 }
79
80 /// <summary>
81 /// 执行无返回值有参数的存储过程
82 /// </summary>
83 /// <param name="sqlCommand">存储过程名</param>
84 /// <param name="parameters">参数</param>
85 /// <returns></returns>
86 public static int ExecuteNonQueryProc(string sqlCommand, Dictionary<string, object> parameters)
87 {
88 int result = 0;
89 using (DbConnection connection = GetConnection())
90 {
91 DbCommand command = GetCommand(sqlCommand, CommandType.StoredProcedure, connection);
92 foreach (KeyValuePair<string, object> p in parameters)
93 {
94 command.Parameters.Add(GetParameter(p.Key, p.Value, command));
95 }
96 connection.Open();
97 result = command.ExecuteNonQuery();
98 command.Parameters.Clear();
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>