我尝试使用TableAdapter.Update()方法将数据集中的数据添加到访问数据库,但它不起作用。这是我的代码。我的Windows窗体上有DataGridView,表(用户)绑定到DataGridView。
private void btnScanGroups_Click(object sender, EventArgs e)
{
foreach (UserGroup group in g)
{
string groupName = group.Name;
string groupID = group.Link;
int userID = 1;
groupsTableAdapter.InsertGroupsQuery(groupName, groupID, userID);
text = text+"\n added "+groupName + " - " + groupID;
richTxtBoxStatus.Text = text;
}
groupsTableAdapter.Fill(facebookGroupAutoPostDBDataSet.Groups);
groupsBindingSource.EndEdit();
groupsTableAdapter.Update(facebookGroupAutoPostDBDataSet.Groups);
}