0

here is a piece of code where i used this variable float acc_pay; float x = float.Parse(tb_quantity.Text) * float.Parse(tb_Price.Text);

        if (comboBox1.Text == "OK")
        {
            acc_pay = 0;
        }
        else if (comboBox1.Text == "NOT OK")
        {

            acc_pay = x;
        }
        else
        {
            MessageBox.Show("Select Any Status ...", "Warining", MessageBoxButtons.OK, MessageBoxIcon.Warning);

        }


        con.Open();
            String query = "INSERT INTO tbl_insertData(Name,Quantity,Unit_Price,Net_Cash,Acc_Payable,Status,Date) VALUES(" +
                "'" + tb_Item_Name.Text + "'," + 
                "'" + tb_quantity.Text + "'," +
                "'" + tb_Price.Text + "'," +
                "'" + tb_Net_Cash.Text + "'," +
                "'" + acc_pay + "'," + //here is error generated on "acc_pay" variable
                "'" + comboBox1.Text + "'," +
                "'" + tb_Date.Text + "')";
            SqlDataAdapter adp = new SqlDataAdapter(query, con);
            adp.SelectCommand.ExecuteNonQuery();
            con.Close();

0 Answers0