Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Transactions Using ADO
Message
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Divers
Thread ID:
01296816
Message ID:
01297323
Vues:
17
>>>>I am trying to write some code utilizing an SQL Transaction in order to be able to RollBack in case any portion of the data manipulation being performed fails. Unfortunatly I am getting the following error:
>>>>
>>>>System.InvalidOperationException: ExecuteScalar requires the command to have a transaction when the connection assigned
>>>>to the command is in a pending local transaction.  The Transaction property of the command has not been initialized.
>>>>
>>>>I have checked online and have found a few references to this error, but the so-called solutions to them, are apparently what I have in my code already. So I am really at a loss. This error specifically happens when I call the DataTable.Update() method to push data changes back up to the SQL Server.
>>>
>>>Didn't think there was a DataTable.Update(). Do you mean TableAdapter (or DataAdapter). You probably need to post some code anyway..
>>>Best,
>>>Viv
>>
>>I created an SQL DataWrapper class, added an Update() method to the DataTable class which calls the Update on the DataAdapter.
>
>How are you setting up the transaction? Are you using the CommandBuilder to generate the update commands? If so I think that setting the SelectCommand.Transaction property before calling .Update will ensure that the generated commands also participate in the transaction (but check this since I'm not 100% sure)
>
>It's hard to post the individual peices of code because it's integrated into a hude class I wrote. I can send the code via E-Mail to whoever is willing to help look at it. But I can't really post it publically...since my agency owns the code... If your interested in taking a look and trying to help, let me know.
>
>I'm afraid that I'm on site all day tomorrow; probably playing catch-up the next day but if no-one else has helped in the meantime I'd be happy to look at it afterwards....
>Good luck,
>Viv

Yes, I have that coded already...unfortunatly didn't work.
________________________
Ben Santiago, MCP & A+
Programmer Analyst (SQL, FoxPro, VB, VB.Net, Java, HTML, ASP, JSP, VBS)
Eastern Suffolk BOCES - Student Data Services


Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
-Rich Cook
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform