.net简单的三层实现功能(2)
来源:未知 责任编辑:责任编辑 发表时间:2015-09-16 20:04 点击:次
12 DbProviderFactory _factory = DbProviderFactories.GetFactory(providerName);
13 DbConnection connection = _factory.CreateConnection();
14 connection.ConnectionString = connectionString;
15 return connection;
16 }
17
18 /// <summary>
19 /// GetCommand 获取命令参数 command 对象
20 /// </summary>
21 /// <param name="commandText"></param>
22 /// <param name="commandType"></param>
23 /// <param name="connection"></param>
24 /// <returns></returns>
25 private static DbCommand GetCommand(string commandText, CommandType commandType, DbConnection connection)
26 {
27 DbCommand command = connection.CreateCommand();
28 command.CommandText = commandText;
29 command.CommandType = commandType;
30 return command;
31 }
32
33 /// <summary>
34 /// GetCommand 方法重载
35 /// </summary>
36 /// <param name="commandText">sql语句</param>
37 /// <param name="connection"></param>
38 /// <returns></returns>
39 private static DbCommand GetCommand(string commandText, DbConnection connection)
40 {
41 DbCommand command = connection.CreateCommand();
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>