Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1733
  • Last Modified:

0040 in ASP giving "Duplicate parameter name" error

I am attempting to upgrade to the latest 9.2.0.1 version of Ora Net Manager and 0040 from 9.0.1.0.  We are running IIS on Win2003 connecting to Oracle 9.2.0.6 on Win2003.

Our DB connection string was like this:
Set db = CreateObject("OracleInProcServer.XOraSession"). _
                        OpenDatabase(DB_CONNECT, DB_ACCOUNT, 0)

now we have the default global.asa from 0040 and
                 set db = OraSession.getDatabaseFromPool(10)

Some of our ASP pages are generating this error on a second load.  

Oracle Automation error '800a01b8'
OIP-04123: Duplicate parameter name, PARAM_ID

The error is caused by: db.Parameters.Add "PARAM_ID" not being removed properly.

1) Is there a way to tell IIS / ASP Parser to ignore these error that doesn't degrade the system?  I know an On Error Resume Next may work, but seems to stall page loads.
2) Or, is there a way to loop through all db.Parameters and remove them?  

I have unremoved parameters on about 1000 pages, so a simple routine to 'db.Parameters.Remove' all of them would save weeks of coding.

Thank you in advance for any advice.
0
egarrison
Asked:
egarrison
1 Solution
 
slightwv (䄆 Netminder) Commented:
It's been several years since I've messed with ASP and OO4O so I probably won't be able to provide a 100% answer but let's see if I can get you there.

The docs on OO4O state that parameters are a collection and can be accessed as such:

snipit from: http://download-west.oracle.com/docs/cd/B10501_01/win.920/a95895/o4o00210.htm

Description
The OraParameters collection maintains a list of OraParameter objects. Unlike the other collection objects, this list is modifiable; you can add to and remove from the collection.

Remarks

You can access the OraParameter objects in this collection by subscripting (using ordinal integers) or by using the name the object was given at its creation. You can obtain the number of OraParameter objects in the collection by using the Count property. Referencing a subscript that does not lie within the collection (0 to Count-1) results in the return of a NULL OraParameter object.

In addition to accessing the OraParameter objects of the collection, you can use the collection to create and destroy parameters by using the Add and Remove methods, respectively.

end snipit

Therefore you should be able to go through a loop and remove them.
0
 
egarrisonCEO / CTOAuthor Commented:
Yes. You are right.  I forgot that they are considered a "Collection". Doing a .COUNT does give the number of Vars "Added".  A simple loop and remove of them by number does work. Thank you for pointing me in the right direction.  

Here is what I added to the footer file.  
i=db.Parameters.count

do while i > 0
    db.Parameters.Remove i
i=i-1
loop
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now