标签:
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