DataGridView
正在更新,但没有Contacts.accdb
改变。
我想改,你能帮忙吗?
解决了 :
private void Form1_Load(object sender, EventArgs e)
{
this.contactsTableAdapter.Fill(this.contactsDataSet.Contacts);
dataGridView1.DataSource = contactsDataSet.Contacts;
try
{
DataRow row = contactsDataSet.Contacts.NewRow();
row[0] = contactsDataSet.Contacts.Rows.Count + 1;
row[1] = "Dsatasdasfo";
row[2] = "Maisgfdgdfuradze";
row[3] = 596110800;
row[4] = "Tserefgdfgdteli Ave, Building 10";
contactsDataSet.Contacts.Rows.Add(row);
}
catch (ConstraintException error)
{
MessageBox.Show(error.Message,"Error",MessageBoxButtons.OK,MessageBoxIcon.Warning);
}
finally
{
contactsTableAdapter.Adapter.Update(contactsDataSet.Contacts);
}
}