Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Database not updated

Author  Topic 

vsc33
Starting Member

3 Posts

Posted - 2008-05-17 : 07:39:09
I have an application that runs on sql server with 5-6 client machine. I have two tables in my database. TableMaster and TableTransaction.

Say a customer has deposited Rs. 500 to his account, this entry is recorded with his unique account number, date in TableTransaction.

In the TableMaster, his account balance amount is updated.

Say his opening balance was Rs. 200, he made a deposit of Rs. 500, so the TableMaster is updated by Rs. 700.

First the TableTransaction sql inserts and than TableMaster sql updates and they are binded through a commit.
This is my process of transaction

'Connection Opens-----
con = connect()
con.Open()

'transaction begins here-------
trans = con.BeginTransaction()

Try

'Data is inserted into Table Transaction---------

cmd = New SqlClient.SqlCommand("INSERT INTO TableTransaction........", con, trans)
cmd.ExecuteNonQuery()

'Data is updated in Table Master-----------

cmd = New SqlClient.SqlCommand("update tablemaster set..........", con, trans)
cmd.ExecuteNonQuery()

'Data commited--------

trans.Commit()

Catch ex As Exception

trans.Rollback()
MsgBox("Bill could not be generated, Please try again.")

End Try

con.Close()

Problem:
--------

Say 1 out of 1000 entry, my TableMaster field is not getting updated. The balance of the particualar customer remains Rs. 200 only thus creating a dispute.

Its not throwing any exception also thus stopping the rollback of the transaction. Is it possible that a row doesnt get updated and still doesnt throws any exception??? I am in a fix.

I read about non-fatal errors which are not caught by sql, but they are caught through try/catch block in vb.net.

The program is designed in a way that at one time only one person can access a customer's account, thus stopping any dispute.

Am not able to diagonise where the error is taking place. Please help. I really want to know why this error is taking place.

Thanks in advance.
   

- Advertisement -