Debasis Mohapatra

Debasis Mohapatra

  • NA
  • 381
  • 56.3k

Edit button code

Dec 4 2018 3:18 AM
Please check the code if it is correct please say ok
protected void btnEdit_Click(object sender, EventArgs e)
{
Button btn = (Button)sender;
string id = ddlarticleno.SelectedValue;
string sql = "select * from production_stock where id=" + id + "";
connection.Open();
SqlDataAdapter dap = new SqlDataAdapter(sql, connection);
DataTable dt = new DataTable();
dap.Fill(dt);
if (dt.Rows.Count > 0)
{
txtproductionorder.Text = dt.Rows[0]["production_order_no"].ToString();
ddlarticleno.SelectedValue = dt.Rows[0]["article_no"].ToString();
txtarticedescription.Text = dt.Rows[0]["article_desc"].ToString();
txtorderedqty.Text = dt.Rows[0]["order_qty"].ToString();
txtfinishedqty.Text = dt.Rows[0]["rec_Quantity"].ToString();
}

Answers (5)