Constraint Problem

  • Thread starter Thread starter Jim Heavey
  • Start date Start date
J

Jim Heavey

Hello, I have been told if I being down a SQL 2000 table, the constraints are
NOT automatically brought down when you use a DataAdapter. Is that true?

In reading about the method for the DataAdapter called "FillSchema", it
indicates that it will the primary key constraint are loaded if one of the
primary keys are identified in the "SelectCommand". It will also populate the
"AllowDBNull", "AutoIncrement", "MaxLength", "ReadOnly" and "Unique".

So if I use the dataadapter and just invoke the "Fill" method, it does not
build the schema, but if I issue the "FillSchema" it will?
 
The constraints are not brought down from sql server. Just calling Fill will
simply pull down the data type. DO NOT call FillSchema in a production app.
Build the schema your self pre call to Fill or post call to Fill. You can
also set the MissingSchemaAction property on dataAdapter prior to the call
to fill if you want your Schema partially built for you in advance. Doing
this does incur some overhead on the db side. If you can afford the
overhead, then it is a nice feature.
 
A simple test on your own will show you what you are looking for ;-)

I just called Fill, using the default for MissingSchemaAction, and wrote out
the schema, and there are no constraints.
 
Back
Top