Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
MM with MSAccess: Dynamic SQL generation not supported..
Message
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
00899573
Message ID:
00899865
Vues:
9
>I'm getting an error during a save against MSAccess:
>
>"Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information.
>
>OakLeaf.MM.Main.Business.mmBusinessObject.HandleException(Exception e)
>OakLeaf.MM.Main.Business.mmBusinessObject.SaveDataSet(DataSet ds, String tableName, String databaseKey, IDbDataAdapter dbAdapter)
>..."
>
>web.config:
>[databases]
> [add key="xxx\Connection" value="PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=d:\clients\xxx\website\database\xxx.mdb" /]
> [add key="xxx\DataAccessClass" value="DataAccessOleDb" /]
> [/databases]
>
>Stupid question: does the MM Business object work with OleDb and MSAccess?

>The save code was working for a few updates, and now, not! Removing changes to what I thought worked before still gets above error. Any clues?

By default, when you are not working with a custom data access class, the ADO.NET Command Builder is used to build your insert, update, and delete commands. In order to do this, the Command Builder needs the original SELECT command used to retrieve data. When you retrieve a DataSet from one of the MM .NET Business object methods, it returns an instance of mmDataSet. This class carries with it the original SELECT command used to retrieve data into the DataSet. Knowing this can help solve your problem.

So....if you are NOT passing an mmDataSet to the SaveDataSet() method, this would cause the error you're seeing (or if you're passing a DataSet that wasn't originally retrieved from an MM .NET business object). If you want to pass a generic DataSet into the SaveDataSet() method, you can simply specify a value in your business object's UpdateSelectStatement property. This SELECT statement will then be used by the Command Builder to create the insert, update, and delete commands.

Regards,
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform