dataadapter update special logic

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm currently planning out a project and I wanted to make sure it's easy to
do something (or at least possible). Basically we're going to have a grid
reporting off of dataset (with a relative dataadapter). My question revolves
around the dataadapter's update ability. First of all the dataset will
contain multiple tables. Now when the Update method is called, there has to
be special logic. Basically, if the user has changed the text of a certain
column in the record, that record is not simply updated. It is copied to a
new record, it's old xref reference is deleted, and a new one is made to the
new record (to keep the old record data in tact). I think that i might be
able to pull this off using only sql (will that work in the context of an
update), but i'd rather do code. Is it possible to like override the update
call and put a bunch of .net code in to work with the records being updated?
not sure.

Thank for any help.
 
gl,

Instead of coding the update call, why not create a stored procedure
that does this, and then have the update command on your data adapter use
that?

Hope this helps.
 
I guess for the purposes of this, i can probably use a stored procedure (as
the requirements stand), i was just wondering about other options. Like
suppose i wanted to write the id out to a file when it was updated or
something. How would I go about doing that (i guess do somethign that's not
easily done via sql)?

Thanks for your help.

Nicholas Paldino said:
gl,

Instead of coding the update call, why not create a stored procedure
that does this, and then have the update command on your data adapter use
that?

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

gl said:
I'm currently planning out a project and I wanted to make sure it's easy
to
do something (or at least possible). Basically we're going to have a grid
reporting off of dataset (with a relative dataadapter). My question
revolves
around the dataadapter's update ability. First of all the dataset will
contain multiple tables. Now when the Update method is called, there has
to
be special logic. Basically, if the user has changed the text of a certain
column in the record, that record is not simply updated. It is copied to a
new record, it's old xref reference is deleted, and a new one is made to
the
new record (to keep the old record data in tact). I think that i might be
able to pull this off using only sql (will that work in the context of an
update), but i'd rather do code. Is it possible to like override the
update
call and put a bunch of .net code in to work with the records being
updated?
not sure.

Thank for any help.
 
gl,

In .NET 2.0, all of the data adapters derive from DbDataAdapter. You
could derive a class from your providers implementation of DbDataAdapter (if
it is not sealed), and then override the OnRowUpdated method so that you
could perform your processing.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

gl said:
I guess for the purposes of this, i can probably use a stored procedure (as
the requirements stand), i was just wondering about other options. Like
suppose i wanted to write the id out to a file when it was updated or
something. How would I go about doing that (i guess do somethign that's
not
easily done via sql)?

Thanks for your help.

Nicholas Paldino said:
gl,

Instead of coding the update call, why not create a stored procedure
that does this, and then have the update command on your data adapter use
that?

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

gl said:
I'm currently planning out a project and I wanted to make sure it's
easy
to
do something (or at least possible). Basically we're going to have a
grid
reporting off of dataset (with a relative dataadapter). My question
revolves
around the dataadapter's update ability. First of all the dataset will
contain multiple tables. Now when the Update method is called, there
has
to
be special logic. Basically, if the user has changed the text of a
certain
column in the record, that record is not simply updated. It is copied
to a
new record, it's old xref reference is deleted, and a new one is made
to
the
new record (to keep the old record data in tact). I think that i might
be
able to pull this off using only sql (will that work in the context of
an
update), but i'd rather do code. Is it possible to like override the
update
call and put a bunch of .net code in to work with the records being
updated?
not sure.

Thank for any help.
 

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

Back
Top