I want to show the names of the tables I have in my SQL Server database in a listbox using vb.net.
I tried this but it's not working:
connetionString = "Data Source=ABDELOUAHED;Initial Catalog=table_creances;integrated security=true"
connection = New SqlConnection(connetionString)
sql = "select * from table_creances"
Try
connection.Open()
adapter = New SqlDataAdapter(sql, connection)
ds.Clear()
adapter.Fill(ds)
connection.Close()
ListBox1.DataSource = ds.Tables(0)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
table_creances
is the name of my database.
Any help is very appreciated.