Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2003
    Posts
    22

    Unanswered: Visual Basic - Oracle Error

    Hi, I'm connecting Visual Basic 6.0 to Oracle. The query
    "select (floor(date1-date2)*24) from reservation where..."
    returns a number. When I try to use that number in an if/then statement below I get the error: "Item cannot be found in the collection corresponding to the requested name or ordinal"

    The if/then statement i'm using:

    If rs("(floor(date1 - date2)*24)") > 48 Then Charge_Procedure

    Please help. thanks.



    Here's the detailed code:

    With rs
    ...
    ...
    ...
    .Source = "select (floor(date1-date2)*24) from reservation where..."

    .ActiveConnection = ...

    .Open

    If rs("(floor(date1-date2)*24)") > 48 Then Charge_Procedure

    End With

  2. #2
    Join Date
    Nov 2003
    Location
    Rotterdam, Netherlands
    Posts
    127
    when u have an expression in a query, u should give an alias to that column in order to address it in the recordset.

    so give an alias to the column and refer to the column with that alias.

    Like
    "select (floor(date1-date2)*24) COL1 from reservation where..."

    then refer as Rs.Fields("COL1")....

Posting Permissions

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