Z
Z D
Hello,
here's the situation:
I have a query that returns 2 columns of data from a table. This data is
loaded into a typed dataset (DS).
I display each column's data in a text-box in ASP.NET.
Now, I dont want to have to save the DS or its corresponding dataadapter in
session or viewstate.
So, once the page is done, I loose the corresponding DS and DA. That's OK
because I have viewstate enabled on the textboxes that's storing the data so
it will be persisted across postbacks that may be generated elsewhere on the
page.
Now, if the user modify's the textboxes and hits the save button, I
obviously want to update this info in the db.
The problem is that i dont have the DA or typed DS anymore, so, I
instantiate new ones, add a new row to the DS, and then send it to the DA to
update it.
The problem now is that the DA doesnt realize that this row already exists
in the database! So, instead of doing an update, it does in insert!!
How do I get around this problem without persisting the DS in
viewstate/session???
I've even tried storing the PK value and setting it on the new DS so that
hopefully the DA would recognize that the row already exists.... no such
luck
So is there any way for me to "trick" the DS into thinking that this is a
row that already exists? If I persist the DS in session/viewstate then it
works fine... so where/how does it track this information? Maybe I can set
it manually so that the DA will know to do an update instead of an
insert....
any suggestions? comments? I would appreciate some help.
thanks
-ZD
here's the situation:
I have a query that returns 2 columns of data from a table. This data is
loaded into a typed dataset (DS).
I display each column's data in a text-box in ASP.NET.
Now, I dont want to have to save the DS or its corresponding dataadapter in
session or viewstate.
So, once the page is done, I loose the corresponding DS and DA. That's OK
because I have viewstate enabled on the textboxes that's storing the data so
it will be persisted across postbacks that may be generated elsewhere on the
page.
Now, if the user modify's the textboxes and hits the save button, I
obviously want to update this info in the db.
The problem is that i dont have the DA or typed DS anymore, so, I
instantiate new ones, add a new row to the DS, and then send it to the DA to
update it.
The problem now is that the DA doesnt realize that this row already exists
in the database! So, instead of doing an update, it does in insert!!

How do I get around this problem without persisting the DS in
viewstate/session???
I've even tried storing the PK value and setting it on the new DS so that
hopefully the DA would recognize that the row already exists.... no such
luck

So is there any way for me to "trick" the DS into thinking that this is a
row that already exists? If I persist the DS in session/viewstate then it
works fine... so where/how does it track this information? Maybe I can set
it manually so that the DA will know to do an update instead of an
insert....
any suggestions? comments? I would appreciate some help.
thanks

-ZD