Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2003
    Posts
    23

    Unanswered: VB Select Query with Autoincrement field

    Dear my friends....

    I have a DB2 column with auto_increment, namely "PO_NO".
    I want to know how to Select a record based on Autoincrement field.
    For example:

    selectquery = SELECT * from TBLPO where PO_NO = " + CSTR(inputPO.Text) + "

    here inputPO.Text is a textbox in VB form.
    On Excute statement, It gives me an ODBC error as [Microsoft][ODBC dBase Driver] Unexpected error from external database driver (9986).

    while if I runthe same query with a Numeric field, it works fine.

    Please let me know how can I search on the BASIS of Autoincrement field.

    Thank you very much.

    Anurag

  2. #2
    Join Date
    Oct 2003
    Posts
    8

    Re: VB Select Query with Autoincrement field

    Originally posted by anuindia
    Dear my friends....

    I have a DB2 column with auto_increment, namely "PO_NO".
    I want to know how to Select a record based on Autoincrement field.
    For example:

    selectquery = SELECT * from TBLPO where PO_NO = " + CSTR(inputPO.Text) + "

    here inputPO.Text is a textbox in VB form.
    On Excute statement, It gives me an ODBC error as [Microsoft][ODBC dBase Driver] Unexpected error from external database driver (9986).

    while if I runthe same query with a Numeric field, it works fine.

    Please let me know how can I search on the BASIS of Autoincrement field.

    Thank you very much.

    Anurag

    Anurag

    I feel your code should be

    selectquery = "SELECT * from TBLPO where PO_NO = " & CStr(inputPO.Text) & ""


    or try this

    selectquery = "SELECT * from TBLPO where PO_NO = '" & CStr(inputPO.Text) & "'"


    since auto increment is a numeric/number/integer field, hence the first option should work. In the field I also feel that Cstr is not required as it is already in a text box which means its been treated as a text.

    I also have question how come a the error returned has "dBase Driver"? Is't the driver for ODBC for Db2?

    Here is an article which might help you

    http://www7b.software.ibm.com/dmdd/l...0302hasin.html

  3. #3
    Join Date
    Oct 2003
    Posts
    23

    Thanks

    Thanks a lot for your suggestion. I believe it is an ODBC Error that I was getting as ODBC is driver for DB2 that I am making use of...!!

    Thanks a lot again.

    regards,

    Anurag

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •