当前位置:Gxlcms >
数据库问题 >
DatabaseFactory.CreateDatabase 方法操作数据库
DatabaseFactory.CreateDatabase 方法操作数据库
时间:2021-07-01 10:21:17
帮助过:4人阅读
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 方法操作数据库
标签: