TableAdapter.Update不会更新

时间:2017-04-23 11:58:29

标签: c# datagridview access tableadapter

我尝试使用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);
} 

enter image description here

0 个答案:

没有答案