TableNames from Database

Is there any way to connect to a database and find out the name of every table in that database?
Note: I don't want to return any data from any of the tables, I only want the table names themself. Google was no help. :(
[233 byte] By [MeatLander] at [2007-11-20 10:59:05]
# 1 Re: TableNames from Database
Not 100% sure, so I'm talking under correction here; but one thing that pops to my mind is :
GetOleDbSchemaTable ( http://kbalertz.com/309488/Retrieve-Schema-Information-Using-GetOleDbSchemaTable-Visual-Basic.aspx)
HanneSThEGreaT at 2007-11-10 3:08:27 >
# 2 Re: TableNames from Database
Thanks a lot for that link, I think that's exactly what I need. I have a second question though...

What's the best way to delete all the data in .Net? From what I understand you're never suppose to have more then one connection to the database open at a time right?

So does that mean I should do it like this: (Sudeo code below)

' Dim X ' Counter Variable
' Dim ArrayTableNames() ' Array of all the tableNames in the database
' Dim Schema ' Returns all TableNames
' Dim DeleteRecordset ' Connection used to execute Delete commands
'
' Try
' Open the Schema
' For X = Schema.Count
' ArrayTableNames(x) = Schema.TableName(X)
' Schema.MoveNext
' Next X
' Close the Schema
' End Try
'
' For X = 0 to (ArrayTableNames.Count - 1)
' Try
' Open DeleteRecordset
' DeleteRecordset.RunQuery ("DELETE FROM ArrayTableNames(x)")
' Close DeleteRecordset
' End Try
' Next X
MeatLander at 2007-11-10 3:09:27 >