Asp and MS-SQL

Posted on 1999-06-28
Medium Priority
Last Modified: 2010-04-09
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!
Question by:mscproj
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 11

Accepted Solution

mouatts earned 90 total points
ID: 1851249
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.


Author Comment

ID: 1851250
Thanks! I get it!

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Find out what you should include to make the best professional email signature for your organization.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question