Emmmanuel FIADUFE

Emmmanuel FIADUFE

  • 784
  • 1.1k
  • 55.3k

C# Window Form Application

Oct 18 2023 4:12 PM

Hello Team,

Please in my window form application, am trying to load  both Supplier and product on the sales page and my issues is Supplier and product are not  loading.

 private void frmPurchaseAdd_Load(object sender, EventArgs e)
        {
            string qry = "Select ProID 'id', pName 'name' from tblProduct";
            string qry2 = "Select SupID 'id', SupName 'name' from tblSupplier";

            MainClass.CBFill(qry, cbProduct, "name", "id");
            MainClass.CBFill(qry2, cmbSupplier, "name", "id");
            if(supID>0)
            {
                cmbSupplier.SelectedValue = supID;
            }
        }

 

  private void GetDetails()
        {
            string qry = "Select * from tblProduct where ProID =" +Convert.ToInt32(cbProduct.SelectedValue)+ "";
            SqlCommand cmd = new SqlCommand(qry, MainClass.con);
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            DataTable dt = new DataTable();
            da.Fill(dt);
            if(dt.Rows.Count>0)
            {
                txtCost.Text = dt.Rows[0]["pCost"].ToString();
                Calculate();
            }
        }


Answers (4)