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




Bob Barrows [MVP] wrote:

anthonybrough@xxxxxxxxxxxxxx wrote:
I am trying to get a value from a RETURNING statement on an Oracle
database and write the result on the same ASP page, but I am getting
the error:

Error Type:
ADODB.Recordset (0x800A0CC1)
Item cannot be found in the collection corresponding to the requested
name or ordinal.
<<<>

This the code that I am using,

conn.beginTrans
sql = "INSERT INTO tbltest(REGID) Values (tbltest_SEQ.nextval )"
conn.execute SQL


sql = "Insert into tblreg_Account (REGID, Account1) Values
(tbltest_SEQ.currval, '" &strAccount &"')RETURNING REGID into
return_REGID "
set r = conn.execute (sql)
response.write r.fields("return_REGID").value

conn.commitTrans

If I leave out :

set r = conn.execute (sql)
response.write r.fields("return_REGID").value

the code executes no problem.

I would be grateful of any pointers in how to resolve.

I'm a little hesitant to reply, never having used Oracle, but in SQL Server,
RETURN values are returned via parameters, not via resultsets. I suspect
it's the same way with Oracle. In order to get the return parameter value,
you have to use a Command object. Try:

const adInteger=3
const adParamReturnValue=4
set cmd=createobject("adodb.command")
cmd.commandtext=sql
cmd.commandtype=1
set cmd.activeconnection=conn
cmd.parameters.append cmd.createparameter("Return", _
adInteger,adParamReturnValue)
cmd.execute
response.write cmd.parameters(0).value

The ADO documentation can be found here.
http://msdn.microsoft.com/library/en-us/ado270/htm/mdmscadoapireference.asp
You should look up the methods I used above to become familiar with them.

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


Hi Bob

Thanks for the reply.

I am new to oracle but have used a SQL Server more recently, bur
unfortunately i didnt have a choice in the selection of the database
:-(
I was hoping that I could accomplish this without a Stored Proc, but i
will take your advice and revert to that method.

Thanks again for the reply.

Regards

Tony

.



Relevant Pages

  • Re: Why not Access...?
    ... Next, I DID NOT SAY Oracle was considered a "best choice," only a sufficient ... It is a desktop application and the database in also on the same machine. ... I also want to know why Oracle is considered a best choice as compared to SQL Server. ... > Also, you need to answer the question regarding whether or not each client> will be using an individual database, and individual copy of a central> organization database, or making straight calls to a centralized ...
    (microsoft.public.sqlserver.server)
  • Re: Merge/Replication or Syncing with Oracle
    ... You can't directly access an Access database on the desktop from a WM 5 app, but you can sync between SQL Compact on the WM device and Access using the Access Syncronizer: ... As for the Oracle issue ... ... Where SQL Compact Edition easily does merge/replication to SQL Server using IIS ... ...
    (microsoft.public.sqlserver.ce)
  • Re: Oracle vs SQL Server as a back end for Access?
    ... post -- comparing back end database engines or replacing the front end ... say that Oracle 10g is better than SQL Server 2000 without determining ... whether or not the total cost of ownership of 10g over SQL Server ... developer than Oracle 10g, in spite of its new web interface. ...
    (comp.databases.ms-access)
  • Re: Oracle licence question
    ... And no - it does not freeze anything, the backups DO NOT affect connections ... SQL Server MVP ... freeze the database and send it to the target. ... What I really wanted is something that lists features I get in Oracle ...
    (comp.databases.oracle.server)
  • Re: General Question about Performance/Tuning and scheduled Tuning
    ... I have a general question about Performance and Tuning. ... some application on a MS SQL Server, ... think that must be possible with a oracle server too. ... Database is so fast as before. ...
    (comp.databases.oracle.server)