sqlcommandbuilder

  • Thread starter Thread starter Andy Choi
  • Start date Start date
A

Andy Choi

Hi all,

I am a newbie in Ado.net. I have a question on the usage of
sqlcommandbuilder. I know it will generated a update statement
automatically. Is there a way to override this. The update statement
it generate is not very efficent because it checks every fields. For
my application, I just need to check the timestamp for validation
purpose. I know sqlcommandbuilder can not be inherited. So I don't
know how to make it to generate the update statement that I want.
please help.


Thanks

Andy
 
Andy:

If you are willing the write your own update logic, then don't use a
commandbuilder. You can set the DataAdapter's update command to whatever it
is that you currently want to set the commandbuilder's update command too
(same for delete and update).

Check out Bill Vaughn's article at http://www.betav.com -> Articles -> MSDN,
Weaning developers from the COmmandBuilder.

They are Ok objects in some cases, but the problem is that while they may
work for your current requirements, if those change, you can run into drama
really quickly, hence, you probably want to avoid them in general. Since
you know what you want your update logic to be, just change the DA's update
command to match it and you should be good to go. If you are already adding
your parameters you probably will only have to add the source column so they
map back together.

It seems like a pain at first but after you get through it once or twice
it's no biggy.

If you have any questions, let me know and I can probably help walk you
through it.

HTH,

Bill
 
Back
Top