'I put this code in the load event ListBox1.Items.Add(CType(GetTables().ToString, String))
Public Shared Function GetTables() As String()
Dim kon As SqlConnection
Dim kom As New SqlCommand
Dim i As Integer
Dim str() As String
kon = New SqlConnection("server=sql...,1444;uid=....;pwd=.....;database=.....")
kon.Open()
kom.Connection = kon
Dim dTable As DataTable
Try
dTable = kon.GetSchema(SchemaType.Mapped, New Object() {Nothing, Nothing, Nothing, "TABLE"})
For i = 0 To dTable.Rows.Count - 1
ReDim Preserve str(i)
str(i) = dTable.Rows(i).Item(2).ToString
Next
Return str
Catch ex As Exception
Return Nothing
End Try
End Function

New Topic/Question
Reply




MultiQuote






|