Click here to Skip to main content
15,908,931 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
in access,
C#
OleDbConnection con=new OleDbCollection();
con.Open();
DataTable schTable=con.GetOleDbSchemaTable(OleDbSchemaGuid.Tables,
					new Object[] { null, null, null, "TABLE" });


how can write similar code for sql?
Posted
Comments
[no name] 19-Jun-13 10:06am    
By using the SQL classes instead of the OleDb classes......

1 solution

There are articles on this site that show how to get a DB schema from SQL Server in C#. I tried embedding a link, but the page kept freezing, so you'll need to look for it.

Code that has to work out the DB schema, always makes me nervous. I cna't think of a good reason to connect to a DB you don't know the schema for.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900