[Mono-aspnet-list] Auto SQL generation during Update requires a valid SelectCommand
grendel at twistedcode.net
Tue May 26 06:53:06 EDT 2009
jan van der watt wrote:
> Thanks, I found that to work too - but there are cases when it doesn't.
> I looked at the Mono (2.4) command builders and they derive from a base
> class which contains a reference to the data adapter, BUT, they declare a
> DUPLICATE data adapter reference in the derived class. So, when you use it
> through the base class, you get this error, because the base class is using
> its own reference (which is not initialised, because the initialised adapter
> reference is in the derived class).
> Still, this is a bug that should be fixed.
> Of course, I could be the silly-billy that missed something - so opinions
> are always welcome.
I've asked our DB guy to take a look at the issue, could you please file a bug for the System.Data
component (see http://mono-project.com/Bugs) and describe your issue there? Thanks!
> YJ Foo wrote:
>> MySqlDataAdapter adapter = Database.CreateDataAdapter(this.Conn, query);
>> MySqlCommandBuilder cb = new MySqlCommandBuilder(adapter);
>> //This fixes the Mono InvalidOperation issue, but it crashes when run
>> under .Net
>> //InvalidOperation: Dynamic SQL generation is not supported against
>> multiple base tables.
>> adapter.UpdateCommand = cb.GetUpdateCommand();
>> adapter.DeleteCommand = cb.GetDeleteCommand();
>> adapter.InsertCommand = cb.GetInsertCommand();
>> I hope this helps. I am running my application on a Windows XP system
>> though, so I am unsure if my fix will be work for you.
More information about the Mono-aspnet-list