Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Close connection or leave open
Message
 
À
02/09/2004 00:39:41
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00938620
Message ID:
00938720
Vues:
25
Bonnie,
Removing the DbConnect.Open() still causes a "connection must be open" exception when Adapter.Update() is called.
If you or someone else could verify that this should be working then I can contact the people at Advantage Database Server and ask them to look into their .NET data provider.

Is there a reason why you do not use the Update() method? It seems like a very convenient method to use.

Einar

>Einar,
>
>Unfortunately, I don't use the .Update() method of the DataAdapter (we're using Stored Procs for all our DataAccess and so we've rolled our own updates) ... however, I'm betting that the problem is because you are explicitly opening the connection rather than letting the .Fill() handle it. Try this:
>
>string dbDataPath = "c:\\it\\TestData\\TestDB.add";
>string dbConStr = "data source=" + dbDataPath ;
>DbConnect = new AdsConnection(dbConStr);
>// -- Comment out the Open
>// DbConnect.Open();
>
>oDS = new DataSet();
>oAdapter = new AdsDataAdapter();
>oAdapter.SelectCommand = new AdsCommand(selectString,DbConnect);
>oCB = new AdsCommandBuilder(oAdapter);
>oAdapter.Fill(oDS, "TimeStamp");
>
>// -- Comment out the Close
>// DbConnect.Close();
>
>// bind oDS to some controls and changes some values
>
>int iRowsAffected = oAdapter.Update(oDS,"TimeStamp");
>
>
>~~Bonnie
Semper ubi sub ubi.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform