473,413 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,413 software developers and data experts.

Getting schema information in C# using ADOX

I need help getting schema information from an existing SQL Server
database. My thought was that you could use ADOX via InterOp. Has
anyone done this successfully and how? I have created a Interop
reference to the ADOX COM component from my C# project. I am able to
open the SqlConnection successfully but it fails with an exception
["No such interface supported"] when I try to set the
..ActiveConnection property of the ADOX database catalog object.
Another strange thing I noticed is that even when you declare and
ADOX.Catalog, the intellisense never lets you create a new
ADOX.Catalog so I ended up creating a ADOX.CatalogClass instead --
something very strange here. Thanks in advance.

SqlConnection sqlConnection = new SqlConnection( myConnectionString );
sqlConnection.Open();

ADOX.Catalog databaseCatalog = new
ADOX.CatalogClass()this.databaseCatalog.ActiveConn ection =
sqlConnection;
Jul 21 '05 #1
2 5538
Developer98115,

The classes in the System.Data.SqlClient namespace are not compatable
with ADOX. Rather, you will have to also set a reference to classic ADO,
and create an instance of ADODB.Connection, which you can then pass to the
catalog.

The reason for the naming is to be expected. Check out the section of
the .NET framework documentation titled "Type Library to Assembly Conversion
Summary". Specifically, check out the section titled "Imported Type
Conversion" which details the way that types are imported into .NET from
COM.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com
"Developer98115" <ca*********@yahoo.com> wrote in message
news:26**************************@posting.google.c om...
I need help getting schema information from an existing SQL Server
database. My thought was that you could use ADOX via InterOp. Has
anyone done this successfully and how? I have created a Interop
reference to the ADOX COM component from my C# project. I am able to
open the SqlConnection successfully but it fails with an exception
["No such interface supported"] when I try to set the
.ActiveConnection property of the ADOX database catalog object.
Another strange thing I noticed is that even when you declare and
ADOX.Catalog, the intellisense never lets you create a new
ADOX.Catalog so I ended up creating a ADOX.CatalogClass instead --
something very strange here. Thanks in advance.

SqlConnection sqlConnection = new SqlConnection( myConnectionString );
sqlConnection.Open();

ADOX.Catalog databaseCatalog = new
ADOX.CatalogClass()this.databaseCatalog.ActiveConn ection =
sqlConnection;

Jul 21 '05 #2
If you're after schema information why don't you just query the sys tables?
"Developer98115" <ca*********@yahoo.com> wrote in message
news:26**************************@posting.google.c om...
I need help getting schema information from an existing SQL Server
database. My thought was that you could use ADOX via InterOp. Has
anyone done this successfully and how? I have created a Interop
reference to the ADOX COM component from my C# project. I am able to
open the SqlConnection successfully but it fails with an exception
["No such interface supported"] when I try to set the
.ActiveConnection property of the ADOX database catalog object.
Another strange thing I noticed is that even when you declare and
ADOX.Catalog, the intellisense never lets you create a new
ADOX.Catalog so I ended up creating a ADOX.CatalogClass instead --
something very strange here. Thanks in advance.

SqlConnection sqlConnection = new SqlConnection( myConnectionString );
sqlConnection.Open();

ADOX.Catalog databaseCatalog = new
ADOX.CatalogClass()this.databaseCatalog.ActiveConn ection =
sqlConnection;

Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jari Kujansuu | last post by:
I can successfully parse XML document using SAX or DOM and I can also validate XML document against schema. Problem is that my program should deal with user-defined schemas which means that when...
5
by: Brandons of mass destruction | last post by:
Ok, I work for a small newspaper thats looking to translate our content to the web. XML sounds like a good way to do this, but i'm a little confused. Is it possible to have <b> and <i> tags in...
0
by: Harold Putman | last post by:
The XmlValidatingReader seems to have changed drastically in .Net Frameworks 1.0 SP3 and beyond with regards to validating XML files that are XML Schemas. Consider the following code: ---...
2
by: Joe | last post by:
Hi All, I am new to using the Access DB and I need some help if someone is able to give it to me. What I want to do is get the names of the columns of certain tables. Not the data in the table...
3
by: Atif | last post by:
Hi I am using MS Access 2000 and want to open the Schema to know about Table's structures like column names, data types, primary keys etc. In SQL Server, we use OpenSchema method of Connection...
2
by: Developer98115 | last post by:
I need help getting schema information from an existing SQL Server database. My thought was that you could use ADOX via InterOp. Has anyone done this successfully and how? I have created a...
2
by: Eric | last post by:
I have an application that uses an Access db. I would like to be able to programmatically change the column names in one of the tables. I know how to get the Schema of the database but how can I...
1
by: Hexman | last post by:
I'm creating a new Access table using ADOX. I can add columns and indexes, but I'm baffled on how to change field properties. Can someone give me a hand? Want to change properties such as:...
3
by: visu | last post by:
Hi , can anyone tell me how to get the complete table schema including constraints, primary key ..etc. through sql Query in Ms access. We can get table information in MS SQL Server by means...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.