Ado recordset problem

  • I am getting the following error while creating a recordset with the field name "Price" whereas price field is existed, but the adodb is giving as it is not there.

    there is no syntax error. I hope this might be the ado version problem pl help. The error is

    ADODB.Recordset error '800a0cc1'

    Item cannot be found in the collection corresponding to the requested name or ordinal

  • Hi mkadambari,

    quote:


    I am getting the following error while creating a recordset with the field name "Price" whereas price field is existed, but the adodb is giving as it is not there.

    there is no syntax error. I hope this might be the ado version problem pl help. The error is

    ADODB.Recordset error '800a0cc1'

    Item cannot be found in the collection corresponding to the requested name or ordinal


    can you post the code?

    Cheers,

    Frank

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • 'PRICE' may be the reserved keyword.Pls try the code after changing it.

    I presume it will work.

  • hi!

    ADO is showing a quite strange behavior sometimes when it comes to reserved words of the target DBMS.

    To avoid any problems like these use something like:

    SELECT id, price AS item_price FROM items

    You'll then be able to reference your "price" field on client side as "item_price" ... no further problems to be expected.

    If you want to use the "price" field using it's native name, you should select it like that:

    SELECT id, [price] FROM items

    But then you'll have to reference it as "price" when using the ADO recordset (ADO seems to throw away the "[]").

    best regards,

    chris.

  • Doesn't look like price is a keyword -- it doesn't highlight as blue in QA.

    Try accessing the price field another way, like:

    rs!Price

    rs(n).Value, where n is the ordinal position of the price field in the recordset

    rs("Price").Value

    Or, try iterating through the fieldnames returned by the recordset thusly, in the VB immediate window:

    ?rs(n).Name

    where n is 0 to # of fields returned by the query. This should tell you if a column named "Price" is actually being returned.

    Vik

  • Are you selecting a text datatype column?

    If so, make sure the text column is the last column in the select list

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply