none
ERROR [07002ز] [Microsoft][ODBC dBASE Driver] Too few parameters. Expected 1. RRS feed

  • Question

  • I'm doing a pretty basic update to a DBASE 4 database (similiar to foxpro) using ODBC drivers.  I have had no issues with running queries so far but now Im having a problem with the update query complaining about a missing parameter.  I'm certain its something I'm overlooking but I have been trying all sorts of stuff with no luck so i thought I would ask for some help.

    The error its returning is a pretty generic "ERROR [07002ز] [Microsoft][ODBC dBASE Driver] Too few parameters. Expected 1."

    My suspicion is that the problem is with the query syntax itself, an extra space perhaps or one missing.  These things can be kind of picky sometimes, but for the life of me I just don't see it.  Any help would be greatly appriciated!

    Here is the query.

     using (OdbcConnection connDBF = new OdbcConnection(DBFConnectionString))
          {
            try
            {
    
              using (OdbcCommand UpdateCMD = new OdbcCommand("UPDATE ART SET ILAGER= @ILAGER WHERE ARTNR='"+ DBFArtnr +"'", connDBF))
                                                
              {
    
                UpdateCMD.Parameters.Add("@ILAGER", OdbcType.Int, Int32.MaxValue,"ILAGER").Value = SQLInStock;
                
    
                            
                connDBF.Open();
                UpdateCMD.ExecuteNonQuery();
                connDBF.Close();
              }
    
    Thursday, September 16, 2010 1:26 PM

Answers

  • Are named parameters supported? Does it make any difference if you replace the "@ILAGER" parameter placeholder with a "?" character?

         using (OdbcCommand UpdateCMD = new OdbcCommand("UPDATE ART SET ILAGER = ? WHERE ARTNR='" + DBFArtnr + "'", connDBF))
    
    


    Paul ~~~~ Microsoft MVP (Visual Basic)
    • Marked as answer by xguild Thursday, September 16, 2010 1:55 PM
    Thursday, September 16, 2010 1:51 PM

All replies

  • Are named parameters supported? Does it make any difference if you replace the "@ILAGER" parameter placeholder with a "?" character?

         using (OdbcCommand UpdateCMD = new OdbcCommand("UPDATE ART SET ILAGER = ? WHERE ARTNR='" + DBFArtnr + "'", connDBF))
    
    


    Paul ~~~~ Microsoft MVP (Visual Basic)
    • Marked as answer by xguild Thursday, September 16, 2010 1:55 PM
    Thursday, September 16, 2010 1:51 PM
  • Awsome thanks mate that did it.  I guess I'm too new school, didn't realize their was other types of Databases besides SQL!


    Thanks again, you rock

    Thursday, September 16, 2010 1:55 PM