Using a dataset's rowstate functionality in .net

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.
 
M

Miha Markic [MVP C#]

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.
 
G

GrantMagic

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.
 
M

Miha Markic [MVP C#]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

DataAdapter update 20
RowState Quirk? 1
NewRow, RowState, and Detached with a CommandBuilder 1
rowstate question 3
RowState 1
RowState Question 1
import from text file, change rowstate 2
New row in a DataList 1

Top