|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
GetSchemaTable not working correctly in SQL 2005/ADO.NET 2.0came back with bad meta-data. For example, if you run GetSchemaTable on Production.BillOfMaterials, BillOfMaterialsID has an IsKey value of false, which is not incorrect. I know I can use catalog views to get the info I need, but I already have the code written and working, albeit this bug. Is this a bug in ADO or something I'm not doing correctly? Here's a snippet of code. =========================================================== {...} try { cmd = conn.CreateCommand(); cmd.CommandText = string.Format("SELECT * FROM {0}",tableName); idr = cmd.ExecuteReader(CommandBehavior.SchemaOnly | CommandBehavior.KeyInfo); DataTable dt = idr.GetSchemaTable(); Populate(dt, tableName); //Use the schema data... idr.Close(); } {...} =========================================================== Thanks in advance. --ROBERT |
|||||||||||||||||||||||