|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
RE: How does GetSchema get foreign key constraints?Show quote "Manish Bafna" wrote: > Hi, > In below Link one MSFT has already answered this query: > http://msdn.microsoft.com/newsgroups/default.aspx?pg=3&lang=en&cr=US&guid=&sloc=en-us&dg=microsoft.public.dotnet.framework.adonet&fltr= > > Look for Get PK:FK post in above page > Hope this helps > -- > Thanks and Regards. > Manish Bafna. > MCP and MCTS. > > > > "uncaged" wrote: > > > The GetSchema documentation hurts, specifically: > > "Understanding the Provider-Specific Schema Collections" at > > http://msdn2.microsoft.com/en-us/library/ms254969(VS.80).aspx > > > > I'm trying to create a DataSet that matches an SQL Server database, and I've > > gotten close. > > > > I'm calling SqlConnection's GetSchema( "Tables"), and then for each table > > name, I'm doing: > > > > sqlDataAdapter = new SqlDataAdapter( "SELECT * FROM " + dataTableName, > > sqlConnection); > > sqlDataAdapter.FillSchema( dataSet, SchemaType.Mapped, dataTableName); > > > > Doing so initializes the data tables of the data set, including primary > > keys. What remains to be done is to create the foreign key constraints. > > > > Calling GetSchema( "ForeignKeys") returns the following columns: > > CONSTRAINT_CATALOG > > CONSTRAINT_SCHEMA > > CONSTRAINT_NAME > > TABLE_CATALOG > > TABLE_SCHEMA > > TABLE_NAME > > CONSTRAINT_TYPE > > IS_DEFERRABLE > > INITIALLY_DEFERRED > > > > What I expected to see was a local table name, the local field of the > > foreign key, the referenced table name, and the primary key field of the > > referenced table. Where is that? > > > > Thanks in advance. > > |
|||||||||||||||||||||||