1
Someone understands this mistake and gets a solution?
Code:
OleDbConnection ConSelect = new OleDbConnection();
ConSelect.ConnectionString = Properties.Settings.Default.dbInvoice;
ConSelect.Open();
OleDbCommand CmmSelect = new OleDbCommand();
CmmSelect.CommandText = "SELECT Qtd, UnitPriceInv FROM JAN WHERE EmgPartInv = ? AND CodCliInv = ? AND InvoiceName = ? ";
CmmSelect.Parameters.Add("@EmgPart", OleDbType.VarChar, 10).Value = txtEmg.Text;
CmmSelect.Parameters.Add("@CodCli", OleDbType.Integer, 18).Value = txtCodCli.Text;
CmmSelect.Parameters.Add("@Invoice", OleDbType.VarChar, 15).Value = label45.Text;
CmmSelect.CommandType = CommandType.Text;
CmmSelect.Connection = ConSelect;
OleDbDataReader DRSelectCond;
DRSelectCond = CmmSelect.ExecuteReader();
DRSelectCond.Read();
Progress has been made, but the error has changed to:
Additional information: No value given for one or more required parameters.
– Maurício Sanches
And then, when in the last case, I put the result values directly in Syntax.. the error is also another:
Additional information: Erro de sintaxe (operador faltando) na expressão de consulta 'EmgPartInv = bt 234 AND CodCliInv = 1 AND InvoiceName = INV123'.
– Maurício Sanches
@Mauríciosanches What the hell is "Bt 234"? - I would suggest testing the separate query directly in the DB, and then applying in the code, otherwise it is difficult.
– Bacco
With the edition that the, the syntax worked. and with the recommendation of @Bacco I discovered an error in the syntax using Query direct in DB. the QTD parameter should actually be Qtdinv. Thanks.
– Maurício Sanches