this my application...when i clicking submit button it should stored on data base ...can anyone help me out..
How to save the data from grid view to sqlserver?
this my application...when i clicking submit button it should stored on data base ...can anyone help me out..

Joxin StanlyPosted Sep 11, 2013, 7:31 AM
i have pasted sample code .. it may help give you some idea
foreach (GridViewRow row in urgridname.Rows)
{
SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["constring"]);
SqlCommand cmd = new SqlCommand();
//find controls value like below
string qty = (row.FindControl("txtQty") as TextBox).Text // in case of textbox
string name = (row.FindControl("txtName") as TextBox).Text
cmd.CommandText = "INSERT INTO YOUR_TABLE_NAME (NAME, CITY) VALUES ('" name + "','" + qty + "')";
cmd.ExecuteNonQuery();
}
selva kumarPosted Sep 12, 2013, 3:34 AM