Constraint Problem

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?
 
G

Greg

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.
 
J

Jim Heavey

So why does the documentation say it does bring down the primary key
constraint?
 
G

Greg

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top