-
List of tables using ADODC
Hi there,
Im trying to connect to a database and retrieve a list of the tables contained.
At present i have this code which is the equivilent using the Windows CE
dev environment.
This returns al the available tables.
Is there a similar way to do this using ADODC
TIA
gs
==
Set rs = CreateObject("ADOCE.Recordset.3.0")
rs.Open "MSysTables", conndb, adOpenKeyset, adLockOptimistic
RecordCount = rs.RecordCount
For arb1 = 0 To RecordCount - 1
List1.AddItem rs.Fields("TableName").Value
rs.MoveNext
Next
rs.Close
Set rs = Nothing
Set conndb = Nothing
==
-
Re: List of tables using ADODC
To gs_London,
You could customise/get inspiration from this code:
The main things is:
Dim rstSchema As ADODB.Recordset
'*** Open our database schema
Set rstSchema = LCon.OpenSchema(adSchemaTables)
ublic Sub DeleteDatabase()
On Error GoTo Errorhandler
Dim LCon As ADODB.Connection
Dim rstSchema As ADODB.Recordset
Dim LsSQL As String
Set LCon = New ADODB.Connection
LCon.Open CONST_ARCHIVE_LConString
'*** Open our database schema
Set rstSchema = LCon.OpenSchema(adSchemaTables)
Do Until rstSchema.EOF
'*** Only return user-defined tables beginning with 'arc'
If UCase(Left(rstSchema!TABLE_NAME, 3)) = CONST_TABLE_START_WITH_ARC Then
LsSQL = "DROP Table " & rstSchema!TABLE_NAME
Call modDataAccess.RunSQLCode(LsSQL, CONST_ARCHIVE_LConString)
End If
rstSchema.MoveNext
LsSQL = ""
Loop
'*** clean up
rstSchema.Close
Set rstSchema = Nothing
Exit Sub
Errorhandler:
Set rstSchema = Nothing
Err.Raise Err.Number, Err.Source, Err.Description
Exit Sub
End Sub
"gs_london" <gs_london@lineone.net> wrote:
>
>Hi there,
>Im trying to connect to a database and retrieve a list of the tables contained.
>
>At present i have this code which is the equivilent using the Windows CE
>dev environment.
>This returns al the available tables.
>
>Is there a similar way to do this using ADODC
>TIA
>gs
>
>==
>Set rs = CreateObject("ADOCE.Recordset.3.0")
>rs.Open "MSysTables", conndb, adOpenKeyset, adLockOptimistic
>RecordCount = rs.RecordCount
>For arb1 = 0 To RecordCount - 1
> List1.AddItem rs.Fields("TableName").Value
> rs.MoveNext
>Next
>rs.Close
>Set rs = Nothing
>Set conndb = Nothing
>==
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
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks