how to update a selected item in a dropdownlist asp.net c# -
hi have dropdown list , want update 1 item when selecting in dropdown list,i wrote code update first item:
dbmethod db = new dbmethod(); datatable dt = new datatable(); string sqlcmd = "select * dbo.web_personnel "; dt = db.returntablewithdata(sqlcmd); dt.rows[0]["job"] = txtjobe.text; dt.rows[0]["childno"] = txtchildnoe.text; dt.rows[0]["salary"] = txtsalary.text; db.updatedatatable(dt, "dbo.web_personnel");
yes code default update first item because hard coding value 0 in it
dt.rows[0]["job"] = txtjobe.text; dt.rows[0]["childno"] = txtchildnoe.text; dt.rows[0]["salary"] = txtsalary.text; just declare variable
int = 0; //change value of desired value , less dt.rows.count() dt.rows[i]["job"] = txtjobe.text; dt.rows[i]["childno"] = txtchildnoe.text; dt.rows[i]["salary"] = txtsalary.text; c#
No comments:
Post a Comment