請教一下在Datagridview做資料更新的問題

看板C_Sharp (C#)作者 (￾NN￾N)時間18年前 (2007/01/04 16:03), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串1/1
各位先進好 小弟目前再設計一個表單就是上面有textbox可供使用者輸入 底下有Datagridview會立即顯示上面所新增的資料 而新增資料的旁邊有編輯按鈕 按完之後會變成可供使用者更新資料的畫面 目前就是卡在我改完資料按更新按鈕沒有動作 這是在rowupdating裡的程式碼 protected void gvwcase_RowUpdating(object sender, GridViewUpdateEventArgs e) { if (!checkField_Case(gvwcase.Rows[e.RowIndex])) e.Cancel = true; SqlConnection connection2=new SqlConnection("Data Source=BRIAN923; Initial Catalog=EIPDB;User ID=eipms;Password=eipms2940"); SqlCommand command2 = new SqlCommand("UPDATE dbo.Refresh SET refresh_content=@refresh_content, refresh_date =@refresh_date WHERE (refresh_partment_id = @refresh_partment_id)", connection2); command2.Parameters.Add("@refresh_content", SqlDbType.VarChar, 50).Value = refresh_content.Text; command2.Parameters.Add("@refresh_date", SqlDbType.Char, 10).Value = refresh_date.Text; connection2.Open(); command2.ExecuteNonQuery(); connection2.Close(); } 請教一下這樣為何還是無法更新呢? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 203.67.241.62

01/05 02:27, , 1F
寫在RowUpdated()事件,而非ing()中
01/05 02:27, 1F
文章代碼(AID): #15dBJcKw (C_Sharp)
文章代碼(AID): #15dBJcKw (C_Sharp)