-4
Gridview에서 update commandField를 사용하고 있습니다. gridview에서 사용 된 Textbox는 이전 값을 반환합니다. 이 코드.행이 asp.net의 gridview에서 업데이트되지 않습니다.
string id = ((Label)GridView1.Rows[e.RowIndex].FindControl("Label6")).Text;
string name = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBox1")).Text;
string number = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBox2")).Text;
string mail = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBox3")).Text;
string address = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBox4")).Text;
string s = "update contacts set c_name='"+name+"', c_number='"+number+"', c_mail = '"+mail+"', c_address = '"+address+"' where contact_id = "+id+"";
getsqlConnection();
dbConnection.Open();
MySqlCommand cmd = new MySqlCommand(s, dbConnection);
cmd.ExecuteNonQuery();
GridView1.EditIndex = -1;
loadcontacts();
제발 도와주세요 ...
업데이트 명령이 표시되지 않습니다. –
[asp.net의 gridview에 데이터 업데이트] 가능한 중복 (http://stackoverflow.com/questions/12075882/updating-data-into-gridview-in-asp-net) –