Navid Farhadi Navid Farhadi - 3 years ago 138
C# Question

Get Columns of a Table by GetSchema() method

I want to get list of columns of a table using

GetSchema
method in
ADO.Net
, my code is:

var dtCols = con.GetSchema("Columns", new[] { "DBName", "TableName" });


And i get an empty
DataTable
, what is the problem?

Answer Source

You must specify a parameter for the "owner" restriction.

var dtCols = con.GetSchema("Columns", new[] { "DBName", null, "TableName" });
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download