I have solve by self but i can able to save one data at a time.
public bool getcomm(string connstring1)
{
try
{
SqlCommand sqlcomm = new SqlCommand(connstring1, con);
con.Open();
sqlcomm.ExecuteNonQuery();
sqlcomm.Dispose();
con.Close();
con.Dispose();
return true;
}
catch (Exception ex)
{
return false;
}
private void btnupdate_Click(object sender, EventArgs e)
{
try
{
string section_name = dataGridView1[0, dataGridView1.CurrentCell.RowIndex].Value.ToString();
string indexorder = dataGridView1[1, dataGridView1.CurrentCell.RowIndex].Value.ToString();
string insert_sql = "insert into magazinesectionmaster( section_name, indexorder)values('" + section_name + "','" + indexorder + "')", con;
if (this.getcomm(insert_sql))
{
MessageBox.Show("Insert Success");
}
else
{
MessageBox.Show("Insert Failed");
}
}
catch
{
throw;
}