As part of the RowUpdatingEventArgs, you get the row that is about to be updated. You can compare the Current and Original DataRowVersions on a per-column basis to see if a column has changed. You shouldn't need to register for ColumnChange at all.
PSResponse: the name of the book is Essential ADO.NET. Cheers, Bob Beauchemin [EMAIL PROTECTED] -----Original Message----- From: Rolls, Robert [mailto:[EMAIL PROTECTED]] Sent: Sunday, May 26, 2002 11:53 PM To: [EMAIL PROTECTED] Subject: Re: [DOTNET] Dataset and Updates. oic - miss understood what part of the WHERE we we're talking about. Sorry about the lame questions but how do I know whether a column has changed? within a row. So I can create the INSERT/UPDATE part correctly. Should I register for ColumnChange events or check the HasVersion per field within the row. Regards Robert. PS. What's the name of the book. -----Original Message----- From: Beauchemin, Bob [mailto:[EMAIL PROTECTED]] Sent: Monday, 27 May 2002 16:46 To: [EMAIL PROTECTED] Subject: Re: [DOTNET] Dataset and Updates. They are different ways to implement optimistic concurrency. To check that none of the columns values have been changed (by timestamp or comparing all old and new values) is much less optmistic than checking just the columns a single user has changed. Suppose, for example, that one clerk changes the checking account balance (and only that is checked) and another changes the charge card balance. Or one changes only the city field in a single table, while another changes the postal code. If you want to save bandwidth, you can either check keyonly (very optimistic), use a timestamp column, or send only before and afters for changed columns, depending on how optimistic you want to be ;-). Bob Beauchemin [EMAIL PROTECTED] -----Original Message----- From: Rolls, Robert [mailto:[EMAIL PROTECTED]] Sent: Sunday, May 26, 2002 11:38 PM To: [EMAIL PROTECTED] Subject: Re: [DOTNET] Dataset and Updates. Thanks Bob Is it standard for people on DB projects to simply send back all the data on an update regardless of any changes to sum or all columns? I see that only sending the correct data back the natural way of saving network bandwidth. Am I not smelling the coffee? Robert. -----Original Message----- From: Beauchemin, Bob [mailto:[EMAIL PROTECTED]] Sent: Monday, 27 May 2002 16:22 To: [EMAIL PROTECTED] Subject: Re: [DOTNET] Dataset and Updates. The portion of the CommandBuilder's functionality you are interested in is where it registers a RowUpdatingEventHandler and processes the arguments to produce a command. The CommandBuilder makes a single roundtrip to the database to obtain metadata to build commands, and makes some assumptions about nullability. There is someone who has already written a custom CommandBuilder, check the archives. In my book (released last week) I chose to illustrate the four DBPROP_ADC_UPDATECRITERIA choices that were implemented by the OLE DB Cursor Service; adCriteriaAllCols (is implemented by the Microsoft Sql, OleDb, Odbc CommandBuilder), adCriteriaUpdCols (which is the one you are asking about), adCriteriaTimeStamp, and adCriteriaKey (generated by one option of the VSDataAdapter wizard) with simple code examples of each. I also replicate (with a simple update example) the batch update capability of the OLE DB Cursor Service when used with SQL Server, and discuss custom CommandBuilders, such as a CommandBuilder that would issue SQL to see if a table in a DataSet exists in the database, and create it if it doesn't. That being said, in most cases you will know what your SQL resultsets would look like in advance, and might rely on a tool (such as the ones in Visual Studio) to generate static commands (or stored procedures) at design time, rather than dynamically generate them at execution time. And the CommandBuilder paradigm is useful only when using the "get rows", "update some rows", "writeback changed rows" pattern. Hope this helps, Bob Beauchemin [EMAIL PROTECTED] -----Original Message----- From: Rolls, Robert [mailto:[EMAIL PROTECTED]] Sent: Sunday, May 26, 2002 10:16 PM To: [EMAIL PROTECTED] Subject: Re: [DOTNET] Dataset and Updates. Does your book show me how to say with a 32 column table, (hypothetical) how to dynamically create an UPDATE/INSERT SQL statement if only 5 columns have been changed? Even better write a chapter on 'Write your own SQLCommandBuilder' and I'm hooked. If the source is set to modified how are the parameters dropped by SQLCommandBuilder does it simply check for null values? Robert. -----Original Message----- From: Shawn Wildermuth [mailto:[EMAIL PROTECTED]] Sent: Monday, 27 May 2002 15:00 To: [EMAIL PROTECTED] Subject: Re: [DOTNET] Dataset and Updates. There is some documentation in MSDN that covers this. The magic happens in the Parameter class (SqlParameter in this case). You will want to set the SourceColumn and SourceVersion (original or modified). I know it is covered extensively in my upcoming book, but you can't wait till September. Hopefully Bob Beauchemin will reply and tell us whether it is covered in his book. Thanks, Shawn Wildermuth [EMAIL PROTECTED] > -----Original Message----- > From: dotnet discussion [mailto:[EMAIL PROTECTED]] > On Behalf Of Rolls, Robert > Sent: Monday, May 27, 2002 12:57 AM > To: [EMAIL PROTECTED] > Subject: [DOTNET] Dataset and Updates. > > > Hi all, > > How do I achieve the same as the SQLCommandBuilder in other > words how do I know what SQL statement to produce given a > row. What columns have changed etc. > > > Regards, > Robert Rolls > > > > > ************************************************************** > ********" > This correspondence is for the named person's use only. It > may contain confidential or legally privileged information or > both. " No confidentiality or privilege is waived or lost by > any " mistransmission. If you receive this correspondence in > error, please immediately delete it from your system and > notify the sender. You must not disclose, copy or rely on > any part of this correspondence if you are not the intended recipient. > > Any views expressed in this message are those of the > individual sender, except where the sender expressly, and > with authority, states them to be the views of Vodafone. > > This email has been checked for viruses. > ************************************************************** > ******************************** > > You can read messages from the DOTNET archive, unsubscribe > from DOTNET, or subscribe to other DevelopMentor lists at > http://discuss.develop.com. > You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. **********************************************************************" This correspondence is for the named person's use only. It may contain confidential or legally privileged information or both. " No confidentiality or privilege is waived or lost by any " mistransmission. If you receive this correspondence in error, please immediately delete it from your system and notify the sender. You must not disclose, copy or rely on any part of this correspondence if you are not the intended recipient. Any views expressed in this message are those of the individual sender, except where the sender expressly, and with authority, states them to be the views of Vodafone. This email has been checked for viruses. **************************************************************************** ****************** You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. **********************************************************************" This correspondence is for the named person's use only. It may contain confidential or legally privileged information or both. " No confidentiality or privilege is waived or lost by any " mistransmission. If you receive this correspondence in error, please immediately delete it from your system and notify the sender. You must not disclose, copy or rely on any part of this correspondence if you are not the intended recipient. Any views expressed in this message are those of the individual sender, except where the sender expressly, and with authority, states them to be the views of Vodafone. This email has been checked for viruses. **************************************************************************** ****************** You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. **********************************************************************" This correspondence is for the named person's use only. It may contain confidential or legally privileged information or both. " No confidentiality or privilege is waived or lost by any " mistransmission. If you receive this correspondence in error, please immediately delete it from your system and notify the sender. You must not disclose, copy or rely on any part of this correspondence if you are not the intended recipient. Any views expressed in this message are those of the individual sender, except where the sender expressly, and with authority, states them to be the views of Vodafone. This email has been checked for viruses. ********************************************************************************************** You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.