how can I actually commit changes to the SQL database programtically?

I have VB 2008 Express Edition with MS SQL Server 2005 Express Edition. I have used the built-in wizards in the VB environment to build a database, connect it to the program and insert, change and delete records. It even saved the records. However, after I modified the program a little (didn't do anything to automatically generated code that saves the records to the database), it quit saving the changes. It will save them as long as I don't quit the application, but once I commit the applciation the changes I made are no longer there. Any suggestions?
LVL 1
evaultAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

chapmandewCommented:
You may have a transaction open and when you close out of the program the transaction rolls back.  Do you know what stored procedures your program is calling?  Is it using inline code in the program?
0
jindalankushCommented:
i think in proram ur using begin tran,rollabck tran,commit tran,
ur commit tran code is not working and rollback tran is working that why u r not able to  see change data.
if you are not executeing rollback tran then ur server speed continues down.
u can see it by sp_lock
0
evaultAuthor Commented:
I am testing the coe and everytime I make a change I click on the save button (code attached) to commit the changes, then either modify znother record or add one. I do not believe I have any open transactions, however I am new to SQL server so I am not going to discount that. How d I tell if I have any open transactions? By the way, I have only the one table in the database, so far.

    Private Sub Tbl_WtyBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tbl_WtyBindingNavigatorSaveItem.Click
        ' save items???
        Me.Validate()
        Me.Tbl_WtyBindingSource.EndEdit()
        Me.TableAdapterManager.UpdateAll(Me.WtyDBDataSet)
    End Sub

Open in new window

0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

chapmandewCommented:
In TSQL you can check the @@TRANCOUNT variable.  If it is > 0 then there are open transactions
0
evaultAuthor Commented:
Thank you chapmandew, I will try thast this afternoon snd report back to you.
0
evaultAuthor Commented:
chapmandew - How do I check that variable programmatically?
0
chapmandewCommented:
In the stored procedure (TSQL) you can do it like this


IF @@TRANCOUNT > 0
PRINT 'A transaction is still open'
ELSE
PRINT 'No transactions open'
0
evaultAuthor Commented:
The language (VB Express 2008) Does not recognize the verb @@TRANCOUNT
0
chapmandewCommented:
That is true...you have to call a stored procedure in vb (using ADO or ADO.net) to use the TSQL code....
0
evaultAuthor Commented:
Actually I found out what is going on. Wehn I process the Excell spreadsheets, pulling information out of them, the transaction won't save. Neither will it save when I cut or copy and paste into any of the fields that I am using on the user form. However, if I manually enter a vlaue into any field, by typing, then the record will save. Any idea on that?
0
chapmandewCommented:
It sounds like you are having an OLE problem.....post your code.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
evaultAuthor Commented:
Sorry about he delay, I'll try to be better. Which part of the code do you want?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.