Problem with an empty BindingSource

I have a problem with data binding using BindingSource, a typed dataset and a DataGridView. My problem: BindingSource, so grid is empty after data binding (bindingSource.Count is 0). I could not understand what I was doing wrong, and I would be very happy if someone could help me with this. My application structure is this: I have two assemblies, one of which is Winforms UI, and the other is a database class library.

User interface

  • DataGridView, datasource as BindingSource
  • BindingSource, datasource = DBAssembly.typedDataset, datamember = DBAssembly.typedDataset.myTable

Database assembly

  • Sql Server CE Database
  • Typed Dataset
  • DB class for database operations

User interface code

Onload

this.db = new DB(); 
db.BindData(); 

DB code

Constructor

create typedDataSet object 
create typedDataSetTableAdapters.MyTableTableAdapter object 
create typedDataSetTableAdapters.TableAdapterManager object 

BindData()

this.myTableTableAdapter.Fill(this.typedDataSet.MyTable) 

.

+3
2

, , , : this.typedDataSet.MyTable.Rows.Count? -? , .

, , DataSource DataMember? , :

bindingSource.DataSource = this.typedDataSet;
bindingSource.DataMember = "MyTable";
dataGridView.DataSource = bindingSource;

bindingSource DataSource this.typedDataSet.MyTable .

, , , / , .

+1

, , , , / , .

, . DataSet DB DataSource BindingSource, . .
0

Source: https://habr.com/ru/post/1702336/


All Articles