Listing tables and views?
-
Hi all, I have an
OleDbConnection
object and I would like to be able to get a list of all the tables and views available through it. Do I need to know anything about the underlying database architecture to do this? For example, if it were mssql, I would know to querysysobjects
. But if I do not know where the underlying database stores the data am I SOL? I suspect the answer is "no" because I can get a list of tables and views when I add this data connection to my server explorer in VS.NET but I haven't a clue how the do it in code. Thanks in advance, Bill -
Hi all, I have an
OleDbConnection
object and I would like to be able to get a list of all the tables and views available through it. Do I need to know anything about the underlying database architecture to do this? For example, if it were mssql, I would know to querysysobjects
. But if I do not know where the underlying database stores the data am I SOL? I suspect the answer is "no" because I can get a list of tables and views when I add this data connection to my server explorer in VS.NET but I haven't a clue how the do it in code. Thanks in advance, Bill -
The easiest way is to use the following query.
Select name, type from Sysobjects
where type = 'U'
or type = 'V'The other way is to use ADOX. However, I have not used it in .Net only in the old VB world. Michael
-
I would recommend doing this from a stored procedure. Really don't want users messing around with sysobjects unless there very knowlegeable. Michael
If I had sql server on the back-end...I would. But we are trying to get at data in Informix...which as far as I know doesn't support sprocs. Like I said before, I really a complete novice with this particular back-end so I was looking for a way to do this that generalized to all ado.net. Your suggestion works great btw, even with the Informix back-end. Thanks again. Bill