
August 27th, 2005, 11:49 AM
|
|
Registered User
|
|
Join Date: Aug 2005
Posts: 1
Time spent in forums: 14 m 36 sec
Reputation Power: 0
|
|
Need help on retrieving table names from database
I have a listbox on my form which i need to fill with the table names from an Access database. I have used the following code to do this, but i think there is a reference missing and i don't know which one, because
Code:
Dim daSQL = New SQLDataAdapter(sSQL2, Connect)
and
Code:
Dim Connect As New SQLConnection(sConnectionString)
keep coming up in red and saying that the end of statement was expected ?!?!?!?
Rather Confused, please help - Code Follows:
Code:
While Not rsACD1.EOF
Dim myItem As String
Dim sConnectionString
Dim dtTables As New DataTable
sConnectionString = cnACD1
'Create connection object
Dim Connect As New SQLConnection(sConnectionString)
Dim sSQL2 As String
sSQL2 = "Select Name from dbo.sysobjects "
sSQL2 = sSQL2 & "where OBJECTPROPERTY(id, N'IsView') = 1 "
sSQL2 = sSQL2 & "OR OBJECTPROPERTY(id, N'IsUSERTABLE') = 1 "
Dim daSQL = New SQLDataAdapter(sSQL2, Connect)
daSQL.Fill (dtTables)
lstACD1.DataSource = dtTables
lstACD1.DisplayMember = "Name"
Wend
|