Article ID: 310128 - Last Review: February 22, 2007 - Revision: 2.1 INFO: When to Use FillSchema and MissingSchemaAction with the DataAdapter in ADO.NETThis article was previously published under Q310128 SUMMARY
The DataAdapter object is optimized for read-only scenarios by default. The Fill method only retrieves the amount of schema that is necessary to populate a DataSet object. To obtain the additional schema that are necessary to update or validate DataSet objects, use one of the following methods for DataSet objects that are populated by the DataAdapater:
MORE INFORMATION
Setting the MissingSchemaAction property of the DataAdapter to AddWithKey is analogous to using the DataAdapter.FillSchema method. Both methods add schema information about primary keys, AutoIncrement fields, nullable fields, and unique indexes.
When to Use DataAdapter's FillSchema MethodUse the FillSchema method of the DataAdapter if you will be reading the same data multiple times. If you use MissingSchemaAction.AddWithKey, the schema is fetched with every call to the DataAdapter.Fill method.When to Use DataAdapter's MissingSchemaAction.AddWithKey Method
When Not to Use Either FillSchema or MissingSchemaAction.AddWithKey
REFERENCES
For more information, see the following topics in the Microsoft Visual Studio .NET Help documentation:
DataAdapter.Fill Method For additional information, click the article numbers below
to view the articles in the Microsoft Knowledge Base:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemDataCommonDataAdapterClassFillTopic.asp (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemDataCommonDataAdapterClassFillTopic.asp) DataAdapter.FillSchema Method http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemDataCommonDataAdapterClassFillSchemaTopic.asp (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemDataCommonDataAdapterClassFillSchemaTopic.asp) DataAdapter.MissingSchemaAction Property http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemDataCommonDataAdapterClassMissingSchemaActionTopic.asp (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemDataCommonDataAdapterClassMissingSchemaActionTopic.asp) MissingSchemaAction Enumeration http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemDataMissingSchemaActionClassTopic.asp (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemDataMissingSchemaActionClassTopic.asp) Loading DataSet Schema Information from XML http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconloadingdatasetschemainformationfromxml.asp (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconloadingdatasetschemainformationfromxml.asp) 301248
(http://support.microsoft.com/kb/301248/EN-US/
)
HOW TO: Update a Database from a DataSet Object by Using Visual Basic .NET
301216
(http://support.microsoft.com/kb/301216/EN-US/
)
HOW TO: Populate a DataSet Object from a Database by Using Visual Basic .NET
| Article Translations
|

Back to the top
