Question SqlTransaction and Stored Procedure

Viper

Member
Joined
Aug 27, 2004
Messages
17
Location
South Africa
Programming Experience
5-10
Hi

I have an employee object that gets transported between the client and server application.

To retrieve the employee object from the server, I call a stored procedure called GetEmployee on the database and the object is constructed with the returned dataset.

Then, when I need to save the employee, I send the employee object to the server, a new SqlConnection is created and a SqlTransaction is started, and then a bunch of executions are done on the server side to save the employee. After that, the transaction is committed, then a new employee object is created from the database based (to include all the new IDs and so on) and that is then returned to the client. (so the object is saved and refreshed in one call).

The problem is, that when retrieving the new object directly after saving it, the old information (before being saved) is returned instead of the updated data. If I do a direct Select statement on the employees table, then the latest data is returned, but if I call the stored procedure, the old data is returned.

Any advice will be appreciated.
 
Back
Top