Difference between MissingSchemaAction and FillSchema?

  • Thread starter Thread starter Bill Todd
  • Start date Start date
B

Bill Todd

I just read that the setting the DataAdapter's MissingSchemaAction
property to AddWithKey will set the primary key, MaxLength and
AllowDbNull.

I also read that FillSchema will set the primary key, MaxLength,
AllowDbNull and AutoIncrement. Is it correct that AddWithKey will not
set the AutoIncrement property of a column but FillSchema will?
 
Hi,

both should set the AutoIncrement property to true. Read this:

Adding Existing Constraints to a DataSet
http://msdn.microsoft.com/library/d...l/cpconaddingexistingconstraintstodataset.asp

It answers your question.

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist

I just read that the setting the DataAdapter's MissingSchemaAction
property to AddWithKey will set the primary key, MaxLength and
AllowDbNull.

I also read that FillSchema will set the primary key, MaxLength,
AllowDbNull and AutoIncrement. Is it correct that AddWithKey will not
set the AutoIncrement property of a column but FillSchema will?
 
Thanks for Teemu's quick response.

Hi Bill,

Thank you for posting in the community!

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to know if Fill the DataSet
with MissingSchemaAction.AddWithKey can set the AutoIncrement property to
true. If there is any misunderstanding, please feel free to let me know.

Based on MSDN document, we can see that if a column in a data source is
identified as auto-incrementing, the FillSchema method, or the Fill method
with a MissingSchemaAction of AddWithKey, can both create a DataColumn with
an AutoIncrement property set to true. However, you will need to set the
AutoIncrementStep and AutoIncrementSeed values yourself.

Please also check the following link for more information about
auto-incrementing columns.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm
l/cpconcreatingautoincrementcolumns.asp

If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Back
Top