From: Carlos G. A. <car...@te...> - 2003-07-28 16:27:56
|
Hello: I was playing trying to give support in the Firebird .NET data provider for SELECT ... FOR UPDATE commands, but i want to know opinions about it, because it's non standard ADO.NET feature ( this is not a great problem while can be of interest for people that works only with Firebird ), and breaks a little what ADO.NET standard says about working with a DataReader opened, see an example: FbConnection connection = new FbConnection(connectionString); connection.Open(); string cursorName = "EMPLOYEE_CURSOR"; FbTransaction transaction = connection.BeginTransaction(); FbCommand sc = new FbCommand("SELECT * FROM EMPLOYEE WHERE EMP_NO BETWEEN 2 AND 10 FOR UPDATE", connection); FbCommand uc = new FbCommand("UPDATE EMPLOYEE SET FIRST_NAME = 'TEST_NAME' WHERE CURRENT OF " + cursorName, connection, transaction); sc.CursorName = cursorName; FbDataReader reader = sc.ExecuteReader(); while (reader.Read()) { uc.ExecuteNonQuery(); } reader.Close(); sc.Dispose(); uc.Dispose(); transaction.Commit(); connection.Close(); Now i want to know your opinion, what do you think about this feature it's good or not ?? :) -- Best regards Carlos Guzmán Álvarez Vigo-Spain |