我有下面的代码,我想确保它按照我的想法做到。
我只是想用select命令填充数据表,我想在我使用的任何命令中使用isolationlevel.readuncommitted。
DataTable dtTable = new DataTable();
TransactionOptions transOptions = new TransactionOptions() { IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted };
using (new TransactionScope(TransactionScopeOption.Required, transOptions))
{
SqlCommand sqlCMD = new SqlCommand(sqlquery, SqlCon);
sqlCMD.CommandTimeout = 0;
SqlDataAdapter sqlDataAdp = new SqlDataAdapter(sqlCMD);
sqlDataAdp.Fill(dtTable);
}
return dtTable;