1
我正在嘗試使用IfxCommand執行一個簡單的選擇查詢。我想將隔離設置爲髒讀,但我只找到了在IfxTransaction環境中設置隔離級別的示例。我不需要交易,因爲我只是發佈一條select語句。以下是我目前的代碼,這是最好的方法嗎?此外,如果您知道隔離級別保持多久以設置爲髒讀,我想知道。設置隔離w/o ifxtransaction?
DataSet ds = new DataSet();
IfxConnection connection = new IfxConnection(ConfigurationManager.ConnectionStrings[connectionStringName].ConnectionString);
IfxCommand command = new IfxCommand();
try
{
connection.Open();
command.Connection = connection;
command.CommandText = "SET ISOLATION TO DIRTY READ";
command.ExecuteNonQuery();
command.CommandText = BuildCommandString();
IfxDataAdapter idap = new IfxDataAdapter(command.CommandText, connection);
idap.Fill(ds);
}
這有幫助嗎?我不熟悉Informix。 http://stackoverflow.com/questions/2111507/informix-net-provider-and-transactionscope-not-rolling-back – Amy 2010-01-28 18:04:06