>I wanted to use ODBC to connect to a back end data store but am going to have to use OLEDB that returns data in an ADO recordset. This is not really a problem but one of the benefits of ODBC is that I can use things like SQLTABLES() to get a list of all tables in a database. Is there a similar command when dealing with ADO?
Hi Tom,
You can use ADO catalog object (ADOX)
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/adobjcatalog.asp. Here's some sample code that connects to SQL Server and displays the list of objects in the tables collection.
#INCLUDE ado.h
lcConStr = "Provider=SQLOLEDB.1;Integrated Security=SSPI; " + ;
"Persist Security Info=False;" + ;
"Initial Catalog=Northwind;Data Source=ServerName"
oCon = CreateObject("ADODB.connection")
oCat = CreateObject("ADOX.Catalog")
oCon.ConnectionString = lcConStr
oCon.Open()
oCat.ActiveConnection = oCon
FOR EACH oTable IN oCat.Tables
? oTable.Name, oTable.Type
ENDFOR
--sb--