Results 1 to 13 of 13

Thread: Is MTS capable enough to do this?

  1. #1

    Thread Starter
    Hyperactive Member jeba's Avatar
    Join Date
    Feb 2000
    Posts
    265

    Is MTS capable enough to do this?

    Hi there!
    I have 10 ASP pages, (all use the same database-but each page using a different table in the database). After going through all the 10 pages, the user is redirected to a page, which contains 'Commit' and 'Cancel' butttons. If the user clicks the Commit button, all the information enetered in those forms needs to be committed. On the other hand if he chooses the Cancel button, all the information entered should be rollbacked.
    So I used the MTS. In the very first page, I have used <%@transaction=requires_New %> and in all other pages, I have given <%@transaction=Supported %>. In the 11th page, if the user clicks the 'Cancel' button, I am calling the ObjectContext.SetAbort method. If the user clicks the 'Commit' button, I am calling the ObjectContext.SetComplete method.
    I thought this will work fine. But to my surprise, what the MTS is doing is it calls the SetAbort/SetComplete methods of ObjectContext at the end of the everypage.
    I am using a SQL-Server database. What should I do to get the desired result? Please, please help me.

    Thanx in Advance.
    J£ßä

  2. #2
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    A good idea would be to put all of the request.form/querystring variables into session variables.

    Code:
       Session("MyVar") = Request.[Form/QueryString]("MyVar")
    Then at the end you can set up a connection object and a recordset object and loop through the tables. If they press commit put them to a page that does this. Otherwise you can submit them to, say, your home page.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  3. #3
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    And I think that putting all the data into session variables is also a scalability killer. What if you have many users at once? What if you need to split the app across servers?

    You should avoid using the session object whenever possible. There are more resource efficient ways to persist state.
    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    [email protected]
    [email protected]


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

  4. #4
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    Best solution I have found is save all data as you go along into a Session variable that holds an xml document. Then save the data in the XML to the database when done.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  5. #5
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    That is a much better solution as it minimizes the Session object and thus conserves server resources.
    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    [email protected]
    [email protected]


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

  6. #6
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844
    Since we're now trying to get the maximum scalability out of this simple question then I suppose we can use hidden form variables, querystrings and/or cookies to totally eliminate state

  7. #7
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    Even if MTS allowed it, it would be a huge scalability killer to keep those resources open on the server
    Well.. uh.. you brought it up :c)
    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    [email protected]
    [email protected]


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

  8. #8
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844
    I didn't mean to start a discussion on scalability, I only wanted to mention that MTS would use a huge amount of resources on the server if that were allowed. But I guess it doesn't matter.... Carry on!

  9. #9

    Thread Starter
    Hyperactive Member jeba's Avatar
    Join Date
    Feb 2000
    Posts
    265
    Hi there!
    Thank you all for the replies. I want to add one more point. Well, the user doesn't just enter data in the first 10 pages, but he can edit/delete the data present in those pages. So I found that MTS can't be used, because MTS doesn't support multiple span of pages. So I used ADO transaction methods.In order to do that I have used a session connection. But my question is, when a user visits the first page, the transaction is started. At this time is the table in the database locked? Because I am encountering a problem that no other user(seperate IE window-another session) is able to start the transaction in the same time. (I am getting the SQL-Server - Timeout expired error). I hope someone will give me the right solution. (At present the database is connected with a single username & password).

    Thanx in advance.
    J£ßä

  10. #10
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844
    As mentioned earlier, don't open a connection to the database and start your transactions until you get ALL of the data. Until you get ALL of the data, store the values in session variables/cookies/etc. After the user completes the process, take all of the values out of the data store (session/cookies/etc.) and insert them into the database all in one step


    hope this helps

    Tom

  11. #11

    Thread Starter
    Hyperactive Member jeba's Avatar
    Join Date
    Feb 2000
    Posts
    265

    thanx Clunietp! But..

    Hi Clunietp!
    If I have to use your idea, then I have to store large amount of data in the session/cookies. Physically, that is impossible. I don't mind the scalability /performance for now. Because it is a intranet application. (Only 4 simultaneous users are expected at the maximum).
    So please help me with the transaction methods of ADO, to work correctly.

    Thanks once again!

    But my question is, when a user visits the first page, the transaction is started. At this time is the table in the database locked? Because I am encountering a problem that no other user(seperate IE window-another session) is able to start the transaction in the same time. (I am getting the SQL-Server - Timeout expired error).
    J£ßä

  12. #12

    Thread Starter
    Hyperactive Member jeba's Avatar
    Join Date
    Feb 2000
    Posts
    265

    pls answer...

    Hi there!
    Please help me with this.
    Thanx again!
    J£ßä

  13. #13
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844
    How much data are we talking about here?

    Maybe you can store your user data in a temp table (in the database) or something and give the user a GUID for a cookie that you can later refer to.....

Posting Permissions

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



Click Here to Expand Forum to Full Width