第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

提交更改后,DataGridView 不更新 c# linq

提交更改后,DataGridView 不更新 c# linq

C#
繁華開滿天機(jī) 2021-07-08 14:07:22
我有一個簡單的客戶注冊表。我在數(shù)據(jù)網(wǎng)格視圖旁邊放置了一些文本框,以便我可以添加和更新用戶。那工作得很好,現(xiàn)在仍然如此。最近,我為客戶定義添加了一個新的 windows 窗體,因此當(dāng)雙擊一行時,會出現(xiàn)一個帶有必填字段的窗體,顯示客戶信息并讓您更改它們。單擊“確定”按鈕將保存對 SQL 數(shù)據(jù)庫的更改。使用網(wǎng)格視圖旁邊的字段,當(dāng)我更新用戶信息時,網(wǎng)格視圖會立即更新并顯示數(shù)據(jù),但是當(dāng)使用新表單更新數(shù)據(jù)時,即使我再次雙擊該行,網(wǎng)格視圖中也不會顯示更新. 當(dāng)我關(guān)閉應(yīng)用程序并再次運(yùn)行它時,我會看到更新的數(shù)據(jù)。我為主表單添加了一個激活事件,以通過再次從數(shù)據(jù)庫中選擇數(shù)據(jù)來更新網(wǎng)格視圖,但沒有成功。這是我用于從側(cè)面板更新的代碼:private void btnUpdate_Click(object sender, EventArgs e){    if (btnUpdate.Text == "Update")    {        txtUsername.Text = ClientsGridView.CurrentRow.Cells["Username"].Value.ToString();        txtPassword.Text = ClientsGridView.CurrentRow.Cells["Password"].Value.ToString();        txtUID.Text = ClientsGridView.CurrentRow.Cells["UID"].Value.ToString();        txtName.Text = ClientsGridView.CurrentRow.Cells["Name"].Value.ToString();        chkIsActive.Checked = (bool)ClientsGridView.CurrentRow.Cells["IsActive"].Value;        chkItemListAccess.Checked = (bool)ClientsGridView.CurrentRow.Cells["ItemListAccess"].Value;        chkMaterialSumAccess.Checked = (bool)ClientsGridView.CurrentRow.Cells["MaterialSumAccess"].Value;        chkPartListAccess.Checked = (bool)ClientsGridView.CurrentRow.Cells["PartListAccess"].Value;        chkPriceListAccess.Checked = (bool)ClientsGridView.CurrentRow.Cells["PriceListAccess"].Value;        btnUpdate.Text = "Apply Update";        btnSubmit.Enabled = false;        txtUsername.ReadOnly = true;    }    else if (btnUpdate.Text == "Apply Update")    {        if (ClientFormValidation())        {            int id = Convert.ToInt32(ClientsGridView.CurrentRow.Cells["ID"].Value.ToString());            var SelectedUser = from Client in ClientsContext.Clients                               where Client.ID == id        }    }}
查看完整描述

2 回答

  • 2 回答
  • 0 關(guān)注
  • 487 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號