Hmmm alright, nevermind that... wasn't assigning the transaction to the
command. Lack of attention. :)

Cheers

On 3 May 2012 11:04, Goncalo Oliveira <[email protected]> wrote:

> Hi,
>
> This probably has nothing to do with MfA, though, any insights are welcome
> as my experience with sqlite isn't much. I'm trying to to a bulk insert
> with 3000 records. It seems to be a good idea to reuse the same command
> object and to do this inside a transaction, so, that's what I'm doing...
>
>                             AppDb db = AppDb.GetInstance( this ); // this
> basically creates a connection object; has some handling to know where to
> write the file
>                             SqliteCommand dbCmd = db.CreateCommand(); //
> Connection.CreateCommand()
>
>                             db.Open(); // Connection.Open()
>
>                             SqliteTransaction dbTransaction =
> db.BeginTransaction(); // Connection.BeginTransaction()
>
>                             foreach ( Translation p in buffer.Data )
>                             {
>                                 db.ExecuteNonQueryRecyclable( dbCmd,
> "insert into Translations ( LCID, [Key], [Value] ) values ( {0}, {1}, {2}
> )", p.LCID, p.Key, p.Value ); // in essence calls dbCmd.ExecuteNonQuery()
>                             }
>
> *                            dbTransaction.Commit(); // this is throwing
> an error stating that there is no active transaction*
>
> Any thoughts? Am I doing something wrong?
> Cheers
>
>
> --
> Gonçalo Oliveira
>



-- 
Gonçalo Oliveira
_______________________________________________
Monodroid mailing list
[email protected]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to