• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 209
  • Last Modified:

Asynchronus function calls - I think

We have a web service on a Windows 2003 server running that is running transactions against another server with SQL Server 2005 installed on it.  My problem is that I have a function that copies one record into another and then end dates the previous record.  Following this, I have a series of updates statements that run against the new copy of the record so that we have a complete history with date tracking.

The interesting part comes when the webservice runs the copy function and once it thinks it's finished it continues on to the update function.  However, the insert function isn't finished writing to the server so none of the updates are processed.  I've tried try and catch statements and in the end had to put a two second delay on my page that was calling the functions.  Is anyone else having this problem?
0
NBAIS
Asked:
NBAIS
  • 3
  • 2
1 Solution
 
roshkmCommented:
have you tried begin transaction and commit transaction method. It will clear the doubt what u assume. may be it is some bug in the web part.

By this u can narrow down, from where the issue is coming from.

Cheers,
RKM
0
 
NBAISAuthor Commented:
Though the web methods call sql statements, they're not calling stored procedures.  The sql is being stored as a string and then executed from the web method.  By doing it in this manner, it may actually be what is causing our problem in the first place.  I'm sure stored procedures run qutie a bit faster.
0
 
roshkmCommented:
it is easier to call Stored Procedure too. Try BEGIN TRANSACTION AND COMMIT TRANSACTION in the stored Procedure and you will find out.

Be careful that this can cause a lock on the database which can get excalated to Shared lock and later exclusive lock.

This depends on how fast the transaction are and how big is ur database.

Rosh K. M.
0
 
roshkmCommented:
... in the stored Procedure and you will find out where the bug is ....

Regards,
Rosh k. M.
0
 
NBAISAuthor Commented:
Thanks for the help.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now