From:
<car...@te...> - 2004-12-31 13:42:22
|
Hello: > Could you please explain to me the difference between the default > behaviour and the 'AddWithKey' behaviour ? Why isn't the default > behaviour consistent with respect to initializing (or not ini- > tializing) the constraints ? From the .NET docs :) ( The default value for MissingSchemaAction is Add ) * MissingSchemaAction.Add: "Adds the necessary columns to complete the schema." * MissingSchemaAction.AddWithKey: "Adds the necessary columns and primary key information to complete the schema. For more information about how primary key information is added to a DataTable <frlrfsystemdatadatatableclasstopic.htm>, see FillSchema <frlrfsystemdataidataadapterclassfillschematopic.htm>.To function properly with the .NET Framework Data Provider for OLE DB, *AddWithKey* requires that the native OLE DB provider obtains necessary primary key information by setting the DBPROP_UNIQUEROWS property, and then determines which columns are primary key columns by examining DBCOLUMN_KEYCOLUMN in the IColumnsRowset. As an alternative, the user may explicitly set the primary key constraints on each *DataTable*. This ensures that incoming records that match existing records are updated instead of appended. When using *AddWithKey*, the .NET Framework Data Provider for SQL Server appends a FOR BROWSE clause to the statement being executed. The user should be aware of potential side effects, such as interference with the use of SET FMTONLY ON statements. See SQL Server Books Online for more information" > Thanks a lot and a Happy Year 2005 to all ! > > PS: I was off-line for a week -- sorry for the long delay. No problem :) -- Best regards Carlos Guzmán Álvarez Vigo-Spain "In the end there can be only one" (Highlander) |