odbc error

Discussion in 'Python' started by Michele Petrazzo, Sep 29, 2004.

  1. I'm using odbc on win95 and I have an incomprehensible error after a query:

    INSERT INTO test VALUES (f1,f2,f3) VALUES ("t1", "t2", "")

    table test and fields f1,f2,f3 exists :) and I can write to this table.

    The error is :
    [Microsoft][Driver ODBC dBase] Too few parameters. Expected 2.

    What can I do?

    Thanks,
    Michele Petrazzo
    Michele Petrazzo, Sep 29, 2004
    #1
    1. Advertising

  2. Michele Petrazzo

    Steve Holden Guest

    Michele Petrazzo wrote:

    > I'm using odbc on win95 and I have an incomprehensible error after a query:
    >
    > INSERT INTO test VALUES (f1,f2,f3) VALUES ("t1", "t2", "")
    >
    > table test and fields f1,f2,f3 exists :) and I can write to this table.
    >
    > The error is :
    > [Microsoft][Driver ODBC dBase] Too few parameters. Expected 2.
    >
    > What can I do?
    >

    The easiest thing to do is use correct syntax, which should put single
    quotes around string literals. The ODBC drivers tend to use standard SQL
    syntax even when the underlying database is a bit more liberal. Try

    INSERT INTO test VALUES (f1,f2,f3) VALUES ('t1', 't2', '')

    and see if that works.

    regards
    Steve
    Steve Holden, Sep 29, 2004
    #2
    1. Advertising

  3. Michele Petrazzo wrote:
    > I'm using odbc on win95 and I have an incomprehensible error after a query:
    >
    > INSERT INTO test VALUES (f1,f2,f3) VALUES ("t1", "t2", "")
    >
    > table test and fields f1,f2,f3 exists :) and I can write to this table.
    >
    > The error is :
    > [Microsoft][Driver ODBC dBase] Too few parameters. Expected 2.
    >
    > What can I do?
    >
    > Thanks,
    > Michele Petrazzo

    In addition to using single quotes and assuming f1, f2, f3 are field
    names, try eliminating the first "VALUES", like this:

    INSERT INTO test (f1,f2,f3) VALUES ('t1', 't2', '')
    Stephen Prinster, Sep 30, 2004
    #3
  4. Steve Holden wrote:
    > Michele Petrazzo wrote:
    >
    >> I'm using odbc on win95 and I have an incomprehensible error after a
    >> query:
    >>
    >> INSERT INTO test VALUES (f1,f2,f3) VALUES ("t1", "t2", "")
    >>
    >> table test and fields f1,f2,f3 exists :) and I can write to this table.
    >>
    >> The error is :
    >> [Microsoft][Driver ODBC dBase] Too few parameters. Expected 2.
    >>
    >> What can I do?
    >>

    > The easiest thing to do is use correct syntax, which should put single
    > quotes around string literals. The ODBC drivers tend to use standard SQL
    > syntax even when the underlying database is a bit more liberal. Try
    >
    > INSERT INTO test VALUES (f1,f2,f3) VALUES ('t1', 't2', '')
    >
    > and see if that works.
    >
    > regards
    > Steve


    It work !!!!
    Thanks very much.

    Michele Petrazzo
    Michele Petrazzo, Sep 30, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Robert Brown
    Replies:
    2
    Views:
    396
    Kevin Spencer
    Jul 3, 2003
  2. bazzer
    Replies:
    0
    Views:
    897
    bazzer
    Mar 24, 2006
  3. bazzer
    Replies:
    1
    Views:
    1,136
    sirfunusa
    Mar 24, 2006
  4. bazzer
    Replies:
    0
    Views:
    10,981
    bazzer
    Mar 30, 2006
  5. Wes Gamble
    Replies:
    1
    Views:
    153
    Gerardo Santana Gómez Garrido
    Apr 5, 2006
Loading...

Share This Page