473,406 Members | 2,816 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

ASP Aggregate Function

I have been searching the boards trying to find an answer to this
question and no luck. I am using a query similar to this:

Select count(col1) from table1

I was having a hard time accessing the count information. After
reading for a while the following SQL examples were given to correct
this issue.

Select count(col1) Blah from table1
Select count(col1) As Blah from table1

Then, supposedly, I am able to access the data using the following:
rsQuery("Blah")
- or -
rsQuery(0)

Neither the rsQuery("Blah") or rsQuery(0) allows me to access the data.
I get the following error.

------------------------------
Provider error '80020009'

Multiple-step OLE DB operation generated errors. Check each OLE DB
status value, if available. No work was done.

/CallLeveraging/assets/forms/adhoc_popup.asp, line 0
-------------------------------------------

The database is Oracle 9 and IIS 6 is the webserver.

Anyone have any ideas at all? Thank you in advance!

Dec 12 '06 #1
3 2467

"Aaron" <aa**********@gmail.comwrote in message
news:11*********************@73g2000cwn.googlegrou ps.com...
>I have been searching the boards trying to find an answer to this
question and no luck. I am using a query similar to this:

Select count(col1) from table1

I was having a hard time accessing the count information. After
reading for a while the following SQL examples were given to correct
this issue.

Select count(col1) Blah from table1
Select count(col1) As Blah from table1

Then, supposedly, I am able to access the data using the following:
rsQuery("Blah")
- or -
rsQuery(0)

Neither the rsQuery("Blah") or rsQuery(0) allows me to access the data.
I get the following error.
This seems like more of an Oracle issue than ASP, and I have no hands-on
with Oracle, but here are some things to try:

1.) Test the query syntax using an Oracle-provided tool. (Something
analogous to SQL Server's Query Analyzer.)
2.) Try explicitly specifying the Value property, rather than relying on the
default property.
The fully qualified prop name is rsQuery.Fields(0).Value. Some environments
(like JScript) assume you want a reference to the Field object unless you
specify the value property.
3.) Trap errors and enumerate the Connection.Errors object when any errors
occur, sometimes there are multiple messages, soime of which may be more
informative.
4.) Show us some code. You might be doing something dumb, like MoveFirst on
a forward-only recordset, or trying to assign a derived, or otherwise
inherently read-only field. That [ever-annoying] error is more typically
associated with recordset operations that change data. I can't recall ever
seeing it happen when reading a scalar value... if it does happen ever, it
doesn't happen often.
-Mark

------------------------------
Provider error '80020009'

Multiple-step OLE DB operation generated errors. Check each OLE DB
status value, if available. No work was done.

/CallLeveraging/assets/forms/adhoc_popup.asp, line 0
-------------------------------------------

The database is Oracle 9 and IIS 6 is the webserver.

Anyone have any ideas at all? Thank you in advance!

Dec 15 '06 #2
Thank you Mark for your sugestions!

The query works perfect if I run directly against the Oracle Database
(Toad, Infomaker, etc)
The only time the error is received is when I try to access the value
of the aggregate function. If I run the query and don't attempt to
access the value I receive no error. Here is the code.

Thank you again for your time!

TABLE
=====
pts_status_type

status_type_id status_type_name
----------------------------------------------------
1 complete
2 active
3 pending
4 inactive
strSQL = "select count(*) as recCount "_
& "from calltrkapp.pts_status_type"

call openCon(strSQL, adOpenForwardOnly, adLockReadOnly)
response.Write("COUNT = " & rsQuery.Fields(0).Value & "<br><br>")
call closeCon()

----------------------------------------------------------------------------------------------------------
Includes
----------------------------------------------------------------------------------------------------------
<%
'DB Variables
Dim dcnDB 'As ADODB.Connection
Dim strSQL 'As string SQL Statement
Dim rsQuery
Dim strCon 'Connection String
'DEV
strCon = "PROVIDER=MSDAORA; Data Source=blah.world; User
ID=*****;Password=*****;"

'''''''''''''''''''''''''''''''''''''''''''''''
' sub openCon(strSQL, cursorType, LockType)
' subprocedure to open database connection with appropriate rights
' Read, Write, Etc
'''''''''''''''''''''''''''''''''''''''''''''''
sub openCon(strSQL, cursorType, LockType)
'ADODB Connection
Set dcnDB = Server.CreateObject("ADODB.Connection")
dcnDB.Open strCon

'ADODB.RecordSet
Set rsQuery = Server.CreateObject("ADODB.RecordSet")
'Response.Write("STRSQL = " & strSQL & "<br><br>")
rsQuery.Open strSQL, dcnDB, cursorType, LockType

end sub
%>

<%
'''''''''''''''''''''''''''''''''''''''''''''''
' sub CloseCon()
' subprocedure to close database connection
'''''''''''''''''''''''''''''''''''''''''''''''
sub closeCon()
set rsQuery = nothing
dcnDB.close
end sub
%>

Mark McGinty wrote:
"Aaron" <aa**********@gmail.comwrote in message
news:11*********************@73g2000cwn.googlegrou ps.com...
I have been searching the boards trying to find an answer to this
question and no luck. I am using a query similar to this:

Select count(col1) from table1

I was having a hard time accessing the count information. After
reading for a while the following SQL examples were given to correct
this issue.

Select count(col1) Blah from table1
Select count(col1) As Blah from table1

Then, supposedly, I am able to access the data using the following:
rsQuery("Blah")
- or -
rsQuery(0)

Neither the rsQuery("Blah") or rsQuery(0) allows me to access the data.
I get the following error.

This seems like more of an Oracle issue than ASP, and I have no hands-on
with Oracle, but here are some things to try:

1.) Test the query syntax using an Oracle-provided tool. (Something
analogous to SQL Server's Query Analyzer.)
2.) Try explicitly specifying the Value property, rather than relying on the
default property.
The fully qualified prop name is rsQuery.Fields(0).Value. Some environments
(like JScript) assume you want a reference to the Field object unless you
specify the value property.
3.) Trap errors and enumerate the Connection.Errors object when any errors
occur, sometimes there are multiple messages, soime of which may be more
informative.
4.) Show us some code. You might be doing something dumb, like MoveFirst on
a forward-only recordset, or trying to assign a derived, or otherwise
inherently read-only field. That [ever-annoying] error is more typically
associated with recordset operations that change data. I can't recall ever
seeing it happen when reading a scalar value... if it does happen ever, it
doesn't happen often.
-Mark

------------------------------
Provider error '80020009'

Multiple-step OLE DB operation generated errors. Check each OLE DB
status value, if available. No work was done.

/CallLeveraging/assets/forms/adhoc_popup.asp, line 0
-------------------------------------------

The database is Oracle 9 and IIS 6 is the webserver.

Anyone have any ideas at all? Thank you in advance!
Dec 15 '06 #3
Strange... See additional code suggestions inline... (Note that the "air
code" below is untested.)

Maybe there are cursor/lock/option idiosyncrasies at play, you might want to
cut to the chase by letting the connection create a default recordset:, as
opposed to creating/opening it yourself

[open connection first...]
Set rsQuery = dcnDB.Execute(strSQL)

And if that doesn't work, and you *really* want to go deep sea fishing,
persist the recordset to XML and dump that to the response:

Set xml = CreateObject("MSXML2.DOMDocument")
rsQuery.Save xml, 1
Response.Write xml.xml

Why that might work when a simple field reference failed I can't even
imagine, but... sometimes when you drop a hook in deep water, there are
interesting things attached when you reel it in.
-Mark

"Aaron" <aa**********@gmail.comwrote in message
news:11**********************@79g2000cws.googlegro ups.com...
Thank you Mark for your sugestions!

The query works perfect if I run directly against the Oracle Database
(Toad, Infomaker, etc)
The only time the error is received is when I try to access the value
of the aggregate function. If I run the query and don't attempt to
access the value I receive no error. Here is the code.

Thank you again for your time!

TABLE
=====
pts_status_type

status_type_id status_type_name
----------------------------------------------------
1 complete
2 active
3 pending
4 inactive
strSQL = "select count(*) as recCount "_
& "from calltrkapp.pts_status_type"
On Error Resume Next
call openCon(strSQL, adOpenForwardOnly, adLockReadOnly)
If rsQuery.State = 0 Then
Response.Write "recordset is closed"
Else
Response.Write "Fields.Count = " & rsQuery.Fields.Count & "<br>"
End If
response.Write("COUNT = " & rsQuery.Fields(0).Value & "<br><br>")
If Err.Number <0 Then
Response.Write DumpConnectionErrors()
End If
call closeCon()

----------------------------------------------------------------------------------------------------------
Includes
----------------------------------------------------------------------------------------------------------
<%
'DB Variables
Dim dcnDB 'As ADODB.Connection
Dim strSQL 'As string SQL Statement
Dim rsQuery
Dim strCon 'Connection String
'DEV
strCon = "PROVIDER=MSDAORA; Data Source=blah.world; User
ID=*****;Password=*****;"


Function DumpConnectionErrors()
If dcnDB.State = 0 then
DumpConnectionErrors = "(connection is closed)<br>"
Exit Function
End If

Dim i, buf
buf = ""
For i = 0 to dcnDB.Errors.Count - 1
buf = buf & CStr(i + 1) & ".) " & dcnDB.Errors(i).Description &
"<br>"
Next

DumpConnectionErrors = buf
End Function

'''''''''''''''''''''''''''''''''''''''''''''''
' sub openCon(strSQL, cursorType, LockType)
' subprocedure to open database connection with appropriate rights
' Read, Write, Etc
'''''''''''''''''''''''''''''''''''''''''''''''
sub openCon(strSQL, cursorType, LockType)
'ADODB Connection
Set dcnDB = Server.CreateObject("ADODB.Connection")
dcnDB.Open strCon

'ADODB.RecordSet
Set rsQuery = Server.CreateObject("ADODB.RecordSet")
'Response.Write("STRSQL = " & strSQL & "<br><br>")
rsQuery.Open strSQL, dcnDB, cursorType, LockType

end sub
%>

<%
'''''''''''''''''''''''''''''''''''''''''''''''
' sub CloseCon()
' subprocedure to close database connection
'''''''''''''''''''''''''''''''''''''''''''''''
sub closeCon()
set rsQuery = nothing
dcnDB.close
end sub
%>

Mark McGinty wrote:
>"Aaron" <aa**********@gmail.comwrote in message
news:11*********************@73g2000cwn.googlegro ups.com...
>I have been searching the boards trying to find an answer to this
question and no luck. I am using a query similar to this:

Select count(col1) from table1

I was having a hard time accessing the count information. After
reading for a while the following SQL examples were given to correct
this issue.

Select count(col1) Blah from table1
Select count(col1) As Blah from table1

Then, supposedly, I am able to access the data using the following:
rsQuery("Blah")
- or -
rsQuery(0)

Neither the rsQuery("Blah") or rsQuery(0) allows me to access the data.
I get the following error.

This seems like more of an Oracle issue than ASP, and I have no hands-on
with Oracle, but here are some things to try:

1.) Test the query syntax using an Oracle-provided tool. (Something
analogous to SQL Server's Query Analyzer.)
2.) Try explicitly specifying the Value property, rather than relying on
the
default property.
The fully qualified prop name is rsQuery.Fields(0).Value. Some
environments
(like JScript) assume you want a reference to the Field object unless you
specify the value property.
3.) Trap errors and enumerate the Connection.Errors object when any
errors
occur, sometimes there are multiple messages, soime of which may be more
informative.
4.) Show us some code. You might be doing something dumb, like MoveFirst
on
a forward-only recordset, or trying to assign a derived, or otherwise
inherently read-only field. That [ever-annoying] error is more typically
associated with recordset operations that change data. I can't recall
ever
seeing it happen when reading a scalar value... if it does happen ever,
it
doesn't happen often.
-Mark

------------------------------
Provider error '80020009'

Multiple-step OLE DB operation generated errors. Check each OLE DB
status value, if available. No work was done.

/CallLeveraging/assets/forms/adhoc_popup.asp, line 0
-------------------------------------------

The database is Oracle 9 and IIS 6 is the webserver.

Anyone have any ideas at all? Thank you in advance!

Dec 15 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Claudio Lapidus | last post by:
Hello I would like to know how can I define/create a new aggregate function. I need a custom function that operate on a set of text strings and return a certain string aggregate based on certain...
1
by: sausage31 | last post by:
I have a table as follows.... Device LotID Result1 Result2 Result3 aaa 1 5 10 15 bbb 1 2 4 6 aaa 2 ...
1
by: nfrodsham | last post by:
In Microsoft's help literature, it states: "You can filter out non-unique rows by using the DISTINCT option of an aggregate function" I am trying to do this in Access 2003 with the COUNT...
10
by: neb | last post by:
Dear member of the forum, Ms access has built-in aggregate function like: -Sum, Max, First, Avg, ... Is it possible to build user-defined aggregate? (if you have any clue, do not hesitate to...
1
by: Najib Abi Fadel | last post by:
Hi i have an ordered table of dates let's say: 1/1/2004 8/1/2004 15/1/2004 29/1/2004 5/2/2004 12/2/2004
0
by: BillCo | last post by:
just wasted a long time figuring out this and I figure if I post it might save someone some pain! Jet (DAO) will allow you to to use nested aggregate functions like building blocks, e.g.: ...
5
by: BillCo | last post by:
I just wasted a long time figuring out this and I figure if I post it might save someone some pain! Jet (DAO) will allow you to to use nested aggregate functions like building blocks, e.g.: ...
2
by: Ian825 | last post by:
I need help writing a function for a program that is based upon the various operations of a matrix and I keep getting a "non-aggregate type" error. My guess is that I need to dereference my...
1
by: Sandro997 | last post by:
Ok. I have a bit of a dilemma here. First, please consider the following function: CREATE OR REPLACE FUNCTION recent_lab(text, labs, treatments) RETURNS float8 AS $BODY$select...
4
by: shapper | last post by:
Hello, I have the following Linq query: var q = (from p in database.Posts join pt in database.PostsTags on p.PostID equals pt.PostID join t in database.Tags on pt.TagID equals t.TagID group...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.