Hi, this could be a bug on Mono.Data.Sqlite?
Making MonoTouch app to be cross platform with ASP.NET version of the app, I
get runtime in each time that I didn't associated the transaction object with
command object. This code came from netcf2 and didn't cause runtime error on
Windows Mobile back on 2010... nor MonoTouch since it was ported on 2011:
using (SqlTransaction tx =
sqlConnection.BeginTransaction())
{
using (SqlCommand sqlCommand = new SqlCommand())
{
sqlCommand.Connection =
Program.dbPocket.sqlConnection;
sqlCommand.CommandType =
CommandType.Text;
sqlCommand.CommandText = "DELETE
Something";
try
{
sqlCommand.ExecuteNonQuery();
}
catch (SqlException ex)
{
DBPocket.DisplaySQLCEErrors(ex,
false);
//MessageBox.Show(sqlCommand.CommandText);
tx.Rollback();
return;
}
// ... More things
}
tx.Commit();
}
On ASP.NET the line with ExecuteNonQuery() throws a runtime exception
System.InvalidOperationException.
If I do what they recommend, so no more runtime error:
sqlCommand.Transaction = tx;
And on MonoTouch it doesn't. Is this a possible bug on MonoTouch that didn't
"followed" maybe some new thing on System.Data.SqlClient due to new versions of
.NET that wasn't "mirrored" to Mono.Data.Sqlite to react in the same way.
I don't know how to call it, since there is no problem on Mono.Data.Sqlite
speaking on functionalities, and is more easier if I don't need to set tx
object on Transaction property all the time specially on things inside methods
that makes queries that caller is in transaction so I'll need to pass tx as
parameter or get this exception all the time....
It appear to be or a new way to use it on ASP.NET or a misuse of it made for
years but some "ADO.NET" let it run in that way.
If it could be a bug on Mono.Data.Sqlite (that let ir run without the need to
set Transaction property all the time..), so I can record it on bugzilla.
As the idea is to be cross platform, maybe this kind of things must give the
same exceptions (also if they are annoying), so misusers like me don't be
fooled hehe.
Karl_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch