Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
OLEDB/ADO equivalent of ODBC - SQLTABLES()
Message
 
 
To
27/07/2004 21:46:27
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00928560
Message ID:
00928567
Views:
25
This message has been marked as the solution to the initial question of the thread.
>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--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform