Using a dataset's rowstate functionality in .net

  • Thread starter Thread starter GrantMagic
  • Start date Start date
G

GrantMagic

I tend to use the SqlDataAdapter class in WinForms projects because once the
inital data is loaded any modifications can be easily added/updated through
a call to the Update() method. I've found in aspnet that the same thing is
possible but because of the stateless nature of the web in order to do this
I have to go through the following steps:

1. First visit to page loads DataSet and binds DataList with data
2. User edits data and submits the pages
3. Reload the DataSet with original data as in 1.
4. Iterate through the DataList and updates rows in the DataSet
5. Call the Update() method to update edited rows

Now am I doing this correctly or is there any way I can skip step 3? It
seems easier to just update each row in the DataList than go through the
process of only updating modified rows.
 
Hi,

You might cache the datataset you use for binding - you'll skip 3. then.
Or, you might manually create a dataset (from modified data) and update it.
 
ok, thanks

How will that effect multiple users.
Will they each get their own section in the cache, or will the same cache
get utilised?


Miha Markic said:
Hi,

You might cache the datataset you use for binding - you'll skip 3. then.
Or, you might manually create a dataset (from modified data) and update
it.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

GrantMagic said:
I tend to use the SqlDataAdapter class in WinForms projects because once
the
inital data is loaded any modifications can be easily added/updated
through
a call to the Update() method. I've found in aspnet that the same thing
is
possible but because of the stateless nature of the web in order to do
this
I have to go through the following steps:

1. First visit to page loads DataSet and binds DataList with data
2. User edits data and submits the pages
3. Reload the DataSet with original data as in 1.
4. Iterate through the DataList and updates rows in the DataSet
5. Call the Update() method to update edited rows

Now am I doing this correctly or is there any way I can skip step 3? It
seems easier to just update each row in the DataList than go through the
process of only updating modified rows.
 
Hi Grant,

That depends on you as you have several options to cache it. :-)
For example, if you store it within session then it is per user, if you
store it in the cache then it is global.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

GrantMagic said:
ok, thanks

How will that effect multiple users.
Will they each get their own section in the cache, or will the same cache
get utilised?


Miha Markic said:
Hi,

You might cache the datataset you use for binding - you'll skip 3. then.
Or, you might manually create a dataset (from modified data) and update
it.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

GrantMagic said:
I tend to use the SqlDataAdapter class in WinForms projects because once
the
inital data is loaded any modifications can be easily added/updated
through
a call to the Update() method. I've found in aspnet that the same thing
is
possible but because of the stateless nature of the web in order to do
this
I have to go through the following steps:

1. First visit to page loads DataSet and binds DataList with data
2. User edits data and submits the pages
3. Reload the DataSet with original data as in 1.
4. Iterate through the DataList and updates rows in the DataSet
5. Call the Update() method to update edited rows

Now am I doing this correctly or is there any way I can skip step 3? It
seems easier to just update each row in the DataList than go through the
process of only updating modified rows.
 
Back
Top