Results 1 to 31 of 31

Thread: how would I do this?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2009
    Posts
    116

    how would I do this?

    I have a page called editTrip. Each "trip" has a few tables of information stored in a SQL Server DB, with several queries fething that data, and one function that funnels it to a single dataset (in the business logic layer), and returns the DS to the page when requesting that specific trip.

    Ok i want to be able to edit that trips information without making several requests to the database. And then do the final "save" at the end. So, I think I need a "strong-typed" dataset in the code behind of editTrip to act as a temporary dataset?

    Say for instance, you edit information in a table of a trip, then you edit more information in a different table (same trip still). I only want it to update the actual SQL database when the user clicks "save all" on the bottom. So i need a temporary dataset? Where would I put it? I just need to know how to make that temporary dataset...Any ideas?

  2. #2
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: how would I do this?

    jtm235,

    I am having trouble following what you are asking?!?

    Can you provide examples of the type of information that you are pulling back, and from what database tables, etc.

    It sounds like what you are after is a transaction, where you want to update all associated tables, and if one fails, you need to roll back the other changes, but without some more information, it is going to be difficult to say.

    Gary

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Dec 2009
    Posts
    116

    Re: how would I do this?

    Ok, Gary...On this page, there will be information for a single "trip"(The page is by no means functional). It calls data from multiple tables (legs, billing codes, and tripInvoices have multiple rows per trip)... whenever I edit the data (like add another billing code, leg, or invoice to a trip, I want that information to update the sql database when the user clicks a "save all" function on the bottom. So I need a temporary dataset to store the trips tables in mean time...

    hope this helps
    Last edited by jtm235; Jun 22nd, 2010 at 09:19 AM.

  4. #4
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: how would I do this?

    hey,
    you can do this through transactions
    and then you commit if there is any problem, just rollback
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Dec 2009
    Posts
    116

    Re: how would I do this?

    ok maybe this can explain what im looking for little better.

    1) I want to grab a dataset from the SQL database.

    2) EDIT that dataset, WITHOUT bothering the SQL database whatsoever. This will involve a lot of client activity and postbacks

    3) Then SUBMIT the modified dataset to SQL database.

    Im pretty sure I can easily accomplish (1) and (3) in the business logic layer, so I just need to know how I can store the "temporary" dataset PER CLIENT or PER PAGE (step 2).

  6. #6
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: how would I do this?

    actually you can store the dataset inside your Session
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Dec 2009
    Posts
    116

    Re: how would I do this?

    I was made to believe that large variables in the Session slow down the server considerably. Although, the dataset wont be more than a few tables, with 1 or a couple rows, spanning 3-15 columns.

    A question about session variables: What actually slows down the server, when clients request the session variable value, or just having them stored? Are they stored in RAM?

  8. #8
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: how would I do this?

    actually you can clear your session value after you get your data.
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  9. #9
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: how would I do this?

    and about the where,
    please take a look
    http://www.eggheadcafe.com/articles/20021016.asp
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  10. #10
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: how would I do this?

    and sorry i found another link for the vbf
    http://www.vbforums.com/showthread.php?t=544023
    also have a look
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  11. #11

    Thread Starter
    Lively Member
    Join Date
    Dec 2009
    Posts
    116

    Re: how would I do this?

    Quote Originally Posted by avrail View Post
    actually you can clear your session value after you get your data.
    like i said i want to do more than get the data, want to edit the dataset and submit it to the database for updates. But it looks like I will be using session variables nevertheless.

    Do you think session variables are my only option for my implementation described above?

  12. #12
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: how would I do this?

    Quote Originally Posted by jtm235 View Post
    like i said i want to do more than get the data, want to edit the dataset and submit it to the database for updates. But it looks like I will be using session variables nevertheless.

    Do you think session variables are my only option for my implementation described above?
    actually,
    you can crate a class , with a static variable,
    Code:
    public static System.Data.DataSet dataSet = null;
    and you can access it using YourClassName.dataSet
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  13. #13

    Thread Starter
    Lively Member
    Join Date
    Dec 2009
    Posts
    116

    Re: how would I do this?

    i like that idea...what if i created a dataset instead, with only datatables? How would I access that dataset in my business logic layer? (from previous experience with data access layer/business logic layer, I only know how to call functions from a dataset in the BLL which returns a DS. Dont know how to manipulate the data in a DS with code...)

  14. #14
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: how would I do this?

    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  15. #15

    Thread Starter
    Lively Member
    Join Date
    Dec 2009
    Posts
    116

    Re: how would I do this?

    cool thanks. but i think i can make the strong-typed dataset easily in visual studio, with the "add dataset" feature. I dont want any table adapters, i just wanna fill tables and view/edit data in that particular DS.

  16. #16
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: how would I do this?

    sound great jtm,
    i am looking forward to see this thread resolved
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  17. #17

    Thread Starter
    Lively Member
    Join Date
    Dec 2009
    Posts
    116

    Re: how would I do this?

    yeah thanks. i just gotta figure out how to do those functions now

  18. #18
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: how would I do this?

    no thanks man, I know you will do it
    good luck,
    and don't forget to remark the thread as resolved when you finish
    and if there is any update let us know
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  19. #19
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: how would I do this?

    Quote Originally Posted by avrail View Post
    actually,
    you can crate a class , with a static variable,
    Code:
    public static System.Data.DataSet dataSet = null;
    and you can access it using YourClassName.dataSet
    A class marked as static would exist for all users of your site. You mentioned earlier that you wanted to allow changes to a DataSet on a per user basis, this would not work with a static class.

    Gary

  20. #20
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: how would I do this?

    Quote Originally Posted by gep13 View Post
    A class marked as static would exist for all users of your site. You mentioned earlier that you wanted to allow changes to a DataSet on a per user basis, this would not work with a static class.

    Gary
    yes, gep
    if i marked the class as static, the object value will be for all users,
    and if you want the dataset per user sure this will not be the right thing to do
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  21. #21

    Thread Starter
    Lively Member
    Join Date
    Dec 2009
    Posts
    116

    Re: how would I do this?

    what if I wanted a dataset "per page"...

  22. #22
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: how would I do this?

    Do you mean a DataSet per page, per user?

    Gary

  23. #23

    Thread Starter
    Lively Member
    Join Date
    Dec 2009
    Posts
    116

    Re: how would I do this?

    yes, a dataset per page, per user...



    I feel like a temporary session object is the only way to do this.

  24. #24
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: how would I do this?

    Quote Originally Posted by jtm235 View Post
    yes, a dataset per page, per user...



    I feel like a temporary session object is the only way to do this.
    i think this is the way that you need
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  25. #25
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: how would I do this?

    but Session will be per user over the whole application
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  26. #26

    Thread Starter
    Lively Member
    Join Date
    Dec 2009
    Posts
    116

    Re: how would I do this?

    I know, but I can set the variable to 'Nothing' when I navigate off the page, so it doesn't take up memory during the entire session.

    all I really need is a dataset that is stored between multiple postbacks of the same page. I could store it in the actual page, but that seems inefficient.

  27. #27
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: how would I do this?

    Quote Originally Posted by jtm235 View Post
    I know, but I can set the variable to 'Nothing' when I navigate off the page, so it doesn't take up memory during the entire session.

    all I really need is a dataset that is stored between multiple postbacks of the same page. I could store it in the actual page, but that seems inefficient.
    you can use ViewState to store your dataset but really i didn't recommend it, because this will effect on your page load
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  28. #28
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: how would I do this?

    you can use SQL Server to manage you session
    http://support.microsoft.com/kb/317604
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  29. #29

    Thread Starter
    Lively Member
    Join Date
    Dec 2009
    Posts
    116

    Re: how would I do this?

    Yeah I looked into viewstate, seems ineffecient. I AM going with session variables. Also, I am researching the different memory options for my session variables. for now, im sticking with In-proc. I still have to do some more research on the effeciency of SQL storage of session variables and determine what fits my application the best.

    Thanks

  30. #30
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: how would I do this?

    i think the SQL well be fair enough,
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  31. #31
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: how would I do this?

    Quote Originally Posted by jtm235 View Post
    I could store it in the actual page, but that seems inefficient.
    No, this wouldn't work, as this would be per user.

    For what you are describing, I believe Session is the only place that you will be able to store it. You will just have to remember to tidy up after yourself once you are finished with the objects.

    Gary

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