save Gridview data to database

  foreach (DataRow dr in GridView1.Rows)
        {
// assumed that you have four columns in your gridview
            string t1 = dr[0].ToString();
             string t2 = dr[1].ToString();
             string dd1 =  dr[2].ToString();    
             string t3 = dr[3].ToString();

             string sql = "insert into table1 values('" + t1 + "','" + t2 + "','" + dd1 + "','" + t3 + "')";

           SqlConnection cn = new SqlConnection("conn");
           SqlCommand cmd = new SqlCommand(sql, cn);
             cn.Open();
            cmd.ExecuteNonQuery();
            cn.Close();
        }