SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
Private con As New SqlCeConnection("Provider=;Data Source= C:\Program Files\Microsoft SQL Server Compact Edition\v3.5\Samples\Northwind.sdf;Persist Security Info=False") Private adapter As New SqlCeDataAdapter(String.Empty, Me.con) Private data As DataTable Private Sub Form1_Load(ByVal sender As Object, _ ByVal e As EventArgs) Handles MyBase.Load con.Open() Me.ComboBox1.DisplayMember = "TABLE_NAME" Me.ComboBox1.ValueMember = "TABLE_NAME" Me.ComboBox1.DataSource = Me.con.GetSchema("TABLES") con.Close() End Sub Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As Object, _ ByVal e As EventArgs) Handles ComboBox1.SelectedIndexChanged If Me.ComboBox1.SelectedItem IsNot Nothing Then Me.data = New DataTable Me.adapter.SelectCommand.CommandText = String.Format("SELECT * FROM [{0}]", Me.ComboBox1.SelectedValue) Me.adapter.Fill(Data) Me.DataGridView1.DataSource = Nothing Me.DataGridView1.Columns.Clear() Me.DataGridView1.DataSource = Me.data End If End Sub .Back to top
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)