Asp and MS-SQL

Now, I need to update several tables to MS-SQL after after users submitting a form. I can write three sql statements to do this, but I'm afraid the user may stop the process in the process or a table got an error.

Besides writing a stored procedure, what other methods can I do this? How about using the batch mode? I'm not sure about this. Thank you!
mscprojAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
mouattsConnect With a Mentor Commented:
Your fears are groundless.

When the user submits a form you asp page will be triggered and will continue until it has finished. If the user hits the stop button all that happens is that the connection is closed but the process on you server will not be interrupted and will complete even though any output will be discarded. (In fact at times many people wish this weren't the case).

The sole exception to this is if you are using RDO from the client to access the database. In which case using a stored procedure would probably be your best bet.

If you are worried that an error in processing one of the statements will cause problems if the other are or are not processed then you have two choices really.

The first is that you check for errors following each statement using the on error clause and take the appropriate action when this is triggered.

Alternatively you can use the batch mode as you suggested.
To do this you will need to call the begintrans method of the connection object. When you are happy with the results you should call the committrans method and if an error occurs call the rollbackreans method.

HTH
Steve
0
 
mscprojAuthor Commented:
Thanks! I get it!
0
All Courses

From novice to tech pro — start learning today.