Click here to Skip to main content
12,996,841 members (119,142 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I am new to, having difficulty populating combobox with sql server compact 3.5 tables.i am encountering the following error "NotSuppoertedException was unhandled "
in this line Error - Me.ComboBox1.DataSource = Me.con.GetSchema("TABLES")
can someome please help me on how do i use the sql query instead of GetSchema method.


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 
        Me.ComboBox1.DisplayMember = "TABLE_NAME" 
        Me.ComboBox1.ValueMember = "TABLE_NAME" 
        Me.ComboBox1.DataSource = Me.con.GetSchema("TABLES") 
  End Sub 
  Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As Object, _ 
                                          ByVal e As EventArgs) Handles ComboBox1.SelectedIndexChanged 
        If Me.ComboBox1.SelectedItem IsNot Nothing Then 
 = New DataTable 
          Me.adapter.SelectCommand.CommandText = String.Format("SELECT * FROM [{0}]", Me.ComboBox1.SelectedValue) 
          Me.DataGridView1.DataSource = Nothing 
          Me.DataGridView1.DataSource = 
        End If 
  End Sub
.Back to top
Posted 23-Sep-12 15:02pm
Sergey Alexandrovich Kryukov 23-Sep-12 23:45pm
I think it can be pretty hard to populate 3.5 tables. Why not using integer number of tables, 3 or 4? :-)

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170622.1 | Last Updated 24 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100