Does anyone know of any ADO or SQL to list the table name contents of a database?
Regards Gary
Printable View
Does anyone know of any ADO or SQL to list the table name contents of a database?
Regards Gary
You want to use the OpenSchema method of a Connection object. I haven't used it, so I don't have an example, but this is from MSDN:
Quote:
The OpenSchema method returns self-descriptive information about the data source, such as what tables are in the data source, the columns in the tables, and the data types supported.
Have an example line of code Jo
Someone sent me this "select * from sysobjects" shed any light.??
http://msdn.microsoft.com/library/de...openschema.asp
There's a link to VB sample code at the end of the page.
Read through that, it dont work. ASP Pages these are. If theres no SQL statement to do it, how can anything else?
This code worked beautifully for me. Just convert it to ASP and you're set. You don't need SQL statements to get data out of a database, they're just one way of doing it.
VB Code:
Dim c As ADODB.Connection Dim rs As ADODB.Recordset Set c = New ADODB.Connection c.Open "Provider=SQLOLEDB;Server=SQLServer2000;Database=MyDatabase;Trusted_Connection=Yes;" Set rs = c.OpenSchema(adSchemaTables) Do While Not rs.EOF Debug.Print rs.Fields("TABLE_NAME") rs.MoveNext Loop rs.Close Set rs = Nothing c.Close Set c = Nothing
Tried that.... found an example... thanks anyhow.
http://www.4guysfromrolla.com/webtech/101799-1.shtml