Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
OLEDB/ADO equivalent of ODBC - SQLTABLES()
Message
 
 
À
27/07/2004 21:46:27
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00928560
Message ID:
00928567
Vues:
23
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--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform