21-12-20, 02:29 PM
السلام عليكم اخوانى
بيظهر لي هذا الخطأ
Operator '>' cannot be applied to operands of type 'void' and 'int'
وهذا هو الكود المستخدم
كود :
public void VerifyEntredQuantity(string Product_S_N,int QuantityEntred)
{
DataTable dt6 = new DataTable();
dt6.Clear();
cmd = new SqlCommand("select * from Products where Product_S_N='" + Product_S_N + "' and Quantity > '" + QuantityEntred + "'", con);
da = new SqlDataAdapter(cmd);
da.Fill(dt6);
}والخطأ بيظهر فى هذا الكود فى السطر رقم ( 5 )
if (VerifyEntredQuantity(ProductS_N, Convert.ToInt32(txtQuantity.Text)) > 1)
كود :
private void txtDiscount_KeyDown(object sender, KeyEventArgs e)
{
if(e.KeyCode == Keys.Enter)
{
if(txtDiscount.Text != string.Empty)
{
foreach(DataGridViewRow Loop in dataGridView1.Rows)
{
if (VerifyEntredQuantity(ProductS_N, Convert.ToInt32(txtQuantity.Text)) > 1)
if(Loop.Cells[1].Value.ToString() == cmbProductName.Text)
{
MessageBox.Show("هذا المنتج موجود بالفعل", "تنبية", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}
}
DataRow Row = dt.NewRow();
Row[0] = ProductS_N;
Row[1] = cmbProductName.Text;
Row[2] = txtPrice.Text;
Row[3] = txtQuantity.Text;
Row[4] = txtDiscount.Text;
Row[5] = txtTotalRequired.Text;
dt.Rows.Add(Row);
dataGridView1.DataSource = dt;
CalculateSumBill();
CalculateBill();
ClearBillDetails();
txtPrice.Focus();
}
else
{
MessageBox.Show("يجب ملئ خانة الخصم", "تنبية", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}بتمني حد يساعني في حل هذه المشكلة
شكراً مقدماً