Administrator

Administrator

  • Tech Writer
  • 2.2k
  • 1.5m

Trouble with OleDbCommand Parameters...

Mar 29 2003 1:14 PM
I can get the following to work as desired by adding a new parameter to my oledbcommand and assigning an appropriate value. [code] string strSumScalar = "SELECT SUM(extPrice) FROM mflynn_software WHERE (mfg = ?)"; [/code] However, things fall apart when I add a little complexity as follows: [code] string strSumScalar = "SELECT SUM(?) FROM mflynn_software WHERE (mfg = ?)"; [/code] I add two new parameters, to the oledbcommand, in the order in which the '?' appear in the CommandText. I assign "extPrice" to the value of the first parameter and the same value to the second parameter that worked in the sample above. When using the executeScalar() method that worked with one parameter, I get an exception error: System.Data.OleDb.OleDbException: Data type mismatch in criteria expression Any ideas on what I am doing wrong?

Answers (1)