我无法将文本框绑定到数据集。它说save1(mytablename)无法创建子列表。这是代码;基本上问题出在我放置********
:
DataSet myDataset = new DataSet("saving1");
DataSet myDataset2 = new DataSet();
myDataAdapter.Fill(myDataset, "saving1");
myDataAdapter2.Fill(myDataset2, "extrasave");
dataGridView1.DataSource = myDataset.Tables["saving1"];
dataGridView3.DataSource = myDataset2.Tables["extrasave"];
myDataset2.Merge(myDataset);
dataGridView2.DataSource = myDataset.Tables["saving1"];
// Use the DataMember property to specify the DataTable.
dataGridView2.DataMember = "saving1";
//dataGridView1.SetDataBinding(ds, "saving1");
//comboBox2.DataSource = ds;
// comboBox2.DisplayMember = "items";
//comboBox2.ValueMember = "items";
comboBox2.DataSource = myDataset.Tables["saving1"];
comboBox2.DisplayMember = "items";
comboBox2.ValueMember = "ID";
quantitys.DataBindings.Add("Text", myDataset, "saving1.quantity");*********
receipts.DataBindings.Add("Text", myDataset, "saving1.receipt");***********
cashs.DataBindings.Add("Text", myDataset, "saving1.cash");**********
cheques.DataBindings.Add("Text", myDataset, "saving1.cheque");********
答案 0 :(得分:0)
尝试评论该行:
// dataGridView2.DataMember = "saving1";
行,因为您已经将DataSource设置为DataSet中的特定DataTable