void dgv_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e) { textBox1.Text = dgv.Rows[e.RowIndex].Cells[0].Value.ToString(); dgv.Hide(); cn.Open(); string query = "select part_no,part_name,mrp from part where part_no='" + textBox1.Text + "'"; dt = new DataTable(); ds = new DataSet(); da = new SqlDataAdapter(query, cn); da.Fill(ds); //Close the Connection cn.Close(); dataGridView1.Rows.Add(1); int r = dataGridView1.Rows.Count; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { //dataGridView1.Rows.Add(1); dataGridView1.Rows[r].Cells["gv_part_no"].Value = ds.Tables[0].Rows[i]["part_no"].ToString(); dataGridView1.Rows[r].Cells["gv_part_name"].Value = ds.Tables[0].Rows[i]["part_name"].ToString(); dataGridView1.Rows[r].Cells["gv_pono"].Value = ""; dataGridView1.Rows[r].Cells["gv_docqty"].Value = 1; dataGridView1.Rows[r].Cells["gv_rate"].Value = ds.Tables[0].Rows[i]["mrp"].ToString(); dataGridView1.Rows[r].Cells["gv_amount"].Value = ""; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)