|
-
November 11th, 1999, 10:38 PM
#1
Listing Tables and their fields
Hi!
I want to get a listing of tables and their fields given a DSN.
I will be using ADO library
I have got a listing of tables using OpenSchema method of connection.
But i don't know how to get a listing of field names in a table.
Present i am doing Select * from table_name for each table
But this will harm the performance and maytake a long time in case of large
number of tables
Can someone suggest a differnt method
I want the method to be database independent
Thanx and Regards
Vijay
-
November 12th, 1999, 03:00 AM
#2
Re: Listing Tables and their fields
this sample get column information for a specific table
Dim cnn1 as ADODB.Connection
Dim rstSchema as ADODB.Recordset
set cnn1 = DataEnvironment1.Connection1
cnn1.Open
set rstSchema = cnn1.OpenSchema(adSchemaColumns, Array("mydb", "dbo", "mytable"))
Dim i as Integer
Do Until rstSchema.EOF
for i = 0 to rstSchema.Fields.Count - 1
List1.AddItem rstSchema.Fields(i).Name & " = " & rstSchema.Fields(i).Value
next i
List1.AddItem "-------------------------------"
rstSchema.MoveNext
Loop
rstSchema.Close
cnn1.Close
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|