Multi-page ASP transactions

Results 1 to 2 of 2

Thread: Multi-page ASP transactions

  1. #1
    Ian P. McCullough Guest

    Default Multi-page ASP transactions

    Ok. So the MTS support in ASP is neat. But heres one for you:<BR><BR>MSDN&#039s introductory page on MTS transactions ( with ASP states "A transaction can only involve one ASP page." So what about the all-too-familiar case of multiple page transactions? For instance:<BR><BR>Say you&#039ve got a site with user registration to a database, but the amount of information you collect about the user is large, so you feel obliged to split it into multiple pages for ease of use. But now you&#039ve lost your transactional ability according to the MSDN citation above. How do you over come this?<BR><BR>I&#039ve thought of two and a half potential solutions, but I&#039d like to solicit some thoughts from the community at large.<BR><BR>1) Store all the data in a session variable until the final page and then commit all at once to the database. Pros: light on excess programming, fast page response times Cons: relies on session variables.<BR><BR>2) Build the user records in temporary tables in the database and only copy them to the real tables once completed. Pros: doesnt rely on session variables. Cons: considerable programming overhead.<BR><BR>3) And this one is where I think the answer lies (for those willing to use session variables) but I&#039m not sure I know enough about how these things work to know for sure: Open a SQL transaction and store the connection as a session variable. This way we can resume the same SQL transaction across multiple pageviews.<BR><BR>Now heres one last thought that cropped up as I was writing this. 3 seems like the way to go but relies on session variables. Is there any way to store an ADO connection object itself (or I suppose we could generalize it to any COM object) in a database? (i.e. to use the database in lieu of session variables as discussed elsewhere on this board?)<BR><BR>Can anyone shed some light on any way to accomplish this that spends the least amount of effort re-inventing the "transaction wheel?"

  2. #2
    Nathen Guest

    Default RE: Multi-page ASP transactions

    The easiest way to accomplish persisting data with multi-page forms is to use hidden inputs. Form1 submits to Form2 and Form1&#039s form values are stored as hidden inputs in Form2. Form2 submits to Form3, etc. The last form in the series will have all values from all the forms and when it is submitted you extract the form values and perform any database operations that need to be done. So, essentailly you&#039ve gathered information from multiple forms and made one trip to the database to store in the information.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts