码迷,mamicode.com
首页 > 数据库 > 详细

DatabaseFactory.CreateDatabase 方法操作数据库

时间:2016-07-01 16:18:49      阅读:456      评论:0      收藏:0      [点我收藏+]

标签:

using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Data.Sql;


  string sql = "";
  //程序启动的时候   Database db
= DatabaseFactory.CreateDatabase();   DbCommand dbCommand = db.GetStoredProcCommand(sql);   db.AddInParameter(dbCommand, "@MenuId", DbType.Int32, menuId);   db.AddOutParameter(dbCommand, "@Result", DbType.Int32, Int32.MaxValue);   db.AddOutParameter(dbCommand, "@ResultMessage", DbType.AnsiString, 1000);   db.ExecuteNonQuery(dbCommand);
  <dataConfiguration defaultDatabase="SqlConnection" />
  <connectionStrings>
    <add name="SqlConnection" connectionString="User ID=sa;Initial Catalog=test;Data Source=192.168.1.100\test;Password=test@12345;" providerName="System.Data.SqlClient" />
  </connectionStrings>

 

DatabaseFactory.CreateDatabase 方法操作数据库

标签:

原文地址:http://www.cnblogs.com/rinack/p/5633174.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!