我們正在使用Microsoft企業庫訪問sql服務器database.We是 有一些關於如何關閉數據庫連接的懷疑。代碼如下。要做到這一點企業庫數據庫連接關閉
DatabaseFactory.SetDatabaseProviderFactory(new DatabaseProviderFactory(), false);
Database db = new DatabaseProviderFactory().Create("Dataconnectionstring");
string sqlCommand = "";
DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);
dbCommand.CommandTimeout = 0;
try
{
success = Convert.ToInt32(db.ExecuteScalar(dbCommand));
return success;
}
so how can we close database connection.
https://stackoverflow.com/questions/15473907/how-to-close-connection-of-microsoft-practices-enterpriselibrary-data-executenon – MatthewMartin