Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / ADO.NET / January 2006

Tip: Looking for answers? Try searching our database.

SqlTransaction won't commit

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jack-b@humlog.com - 06 Jan 2006 06:27 GMT
Hi,

I'm running a process which takes records from an XML file and inserts
them one at a time into a database table. I'm using an SqlTransaction
to commit after each record is inserted but it doesn't seem to work. (I
need to commit each time because I sleep the thread after inserting 10
record for 1hour)

Code -

mySqlConnection = SqlConnection
mySqlConnection.ConnectionString = ConnectionString
mySqlConnection.Open()

mySqlTransaction = CreateJobDetails.mySqlConnection.BeginTransaction()

* retrieve record from XML file CODE ***

* push to DB ***

//assign parameter code etc etc

SqlHelper.ExecuteNonQuery( _
                           mySqlTransaction, _
                          CommandType.StoredProcedure, _
                           ProcName, _
                          InsertParameter)

           If InsertParameter(INDEX_RETURN_VALUE).Value <> 0 Then
               mySqlTransaction.Rollback()
               Throw New
StoredProcedureException(InsertParameter(INDEX_ERROR).Value)

           Else
               mySqlTransaction.Commit()
               mySqlTransaction.Dispose()
               mySqlConnection.Close()
           End If

***************************************
Do I have to state something in the stored procedure??

Any ideas??

Cheers,
Jack
Jim Hughes - 06 Jan 2006 16:19 GMT
> Hi,
>
[quoted text clipped - 42 lines]
> Cheers,
> Jack

Show the contents of the stored procedure as well as the parameters being
defined along with sample values and we can probably tell you.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.