我已经绑定datagridview
与datatable
(Growns)。我的主要目标是,该用户可以使用datagridview
(dataGridView1),填充和更新数据,当单击button
SAVE时,所有数据都将保存到数据表中,因为我需要它进行进一步的工作。
一切正常,除了将数据保存到 datatable。我究竟做错了什么?
这是我的代码:
private void Form2_Load(object sender, EventArgs e) {
// TODO: This line of code loads data into the 'tekmovalecDataSet.Odrasli' table. You can move, or remove it, as needed.
this.grownsTableAdapter.Fill(this.competitorDataSet.Odrasli);
}
private void buttonSave_Click(object sender, EventArgs e) {
if (EmptySpace())
{
CompetitorDataSet.OdrasliRow newGrownsRow = competitorDataSet.Growns.NewGrownsRow();
newGrownsRow.StN = textStN.Text;
newGrownsRow.Name = textN.Text;
newGrownsRow.Surname = textSN.Text;
newGrownsRow.Club = textC.Text;
newGrownsRow.YBirth = textYB.Text;
competitorDataSet.Growns.Rows.Add(OdrasliNova);
competitorDataSet.Growns.AcceptChanges();
this.dataGridView1.DataSource …
Run Code Online (Sandbox Code Playgroud)