p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

asp_databases thread: unbound data column?


Message #1 by "Patrick" <patrick007@h...> on Wed, 19 Jul 2000 16:51:47 -0400

Hi

I ran into a problem with displaying an unbound data column?



This is the select statement:

select cpuspeed, count (cpuspeed)

from hwinfo

group by cpuspeed

order by cpuspeed



Displaying the column cpuspeed is no problem.

Response.Write objRs("cpuspeed")



But when I tried to do it again with the count column it didn't like it.

Response.Write objRs("count")

The error was:

"ADO could not find the object in the collection corresponding to the name

or ordinal reference requested by the application. "

This makes sense since it is not a name of a column, it is calculated.

But the question is how do you display this field? I verified the sql syntax

and it is correct (displays fine in query analyzer).

Maybe read the recordset into a variable then display it?



This is the output from the query analyzer

cpuspeed

-------- -----------

100MHz   10

120MHz   5

133MHz   26



Thanks

Patrick



Message #2 by "Mark Morgan" <mark.morgan@v...> on Thu, 20 Jul 2000 11:27:50 +0100
Patrick,

	Give the count(cpuspeed) a column alias eg :



select cpuspeed, count (cpuspeed) cpuspeedCount

from hwinfo

group by cpuspeed

order by cpuspeed



Then you can do :



Response.Write objRs("cpuspeedCount")



Regards,





Mark.



-----Original Message-----

From: Patrick 

Sent: 19 July 2000 21:52

To: ASP Databases

Subject: [asp_databases] unbound data column?







Hi

I ran into a problem with displaying an unbound data column?



This is the select statement:

select cpuspeed, count (cpuspeed)

from hwinfo

group by cpuspeed

order by cpuspeed



Displaying the column cpuspeed is no problem.

Response.Write objRs("cpuspeed")



But when I tried to do it again with the count column it didn't like it.

Response.Write objRs("count")

The error was:

"ADO could not find the object in the collection corresponding to the name

or ordinal reference requested by the application. "

This makes sense since it is not a name of a column, it is calculated.

But the question is how do you display this field? I verified the sql syntax

and it is correct (displays fine in query analyzer).

Maybe read the recordset into a variable then display it?



This is the output from the query analyzer

cpuspeed

-------- -----------

100MHz   10

120MHz   5

133MHz   26



Thanks

Patrick



Message #3 by "Patrick" <patrick007@h...> on Thu, 20 Jul 2000 08:53:21 -0400
 I didn't even think of that.  It worked excellent.



Thanks very much Mark.



Patrick





----- Original Message -----

From: Mark Morgan 

To: ASP Databases <asp_databases@p...>

Sent: Thursday, July 20, 2000 6:27 AM

Subject: [asp_databases] RE: unbound data column?





> Patrick,

> Give the count(cpuspeed) a column alias eg :

>

> select cpuspeed, count (cpuspeed) cpuspeedCount

> from hwinfo

> group by cpuspeed

> order by cpuspeed

>

> Then you can do :

>

> Response.Write objRs("cpuspeedCount")

>

> Regards,

>

>

> Mark.

>

> -----Original Message-----

> From: Patrick

> Sent: 19 July 2000 21:52

> To: ASP Databases

> Subject: [asp_databases] unbound data column?

>

>

>

> Hi

> I ran into a problem with displaying an unbound data column?

>

> This is the select statement:

> select cpuspeed, count (cpuspeed)

> from hwinfo

> group by cpuspeed

> order by cpuspeed

>

> Displaying the column cpuspeed is no problem.

> Response.Write objRs("cpuspeed")

>

> But when I tried to do it again with the count column it didn't like it.

> Response.Write objRs("count")

> The error was:

> "ADO could not find the object in the collection corresponding to the name

> or ordinal reference requested by the application. "

> This makes sense since it is not a name of a column, it is calculated.

> But the question is how do you display this field? I verified the sql

syntax

> and it is correct (displays fine in query analyzer).

> Maybe read the recordset into a variable then display it?

>

> This is the output from the query analyzer

> cpuspeed

> -------- -----------

> 100MHz   10

> 120MHz   5

> 133MHz   26

>

> Thanks

> Patrick

>

>

> ---

> ---

> You are currently subscribed to asp_databases


$subst('Email.Unsub')

>

>


  Return to Index