請教一下在Datagridview做資料更新的問題
各位先進好
小弟目前再設計一個表單就是上面有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
01/05 02:27, 1F
C_Sharp 近期熱門文章
PTT數位生活區 即時熱門文章
7
20