Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2005-01-06 : 08:28:16
|
| Eleonora writes "I have this scriptDim rsMonthset rsMonth=Server.CreateObject("ADODB.Recordset")Set rsMonth = Conn.execute("SELECT DISTINCT month(DateApplied)) FROM seekers")While Not rsMonth.EOF=month(rsMonth("DateApplied")) rsMonth.MoveNextWendI want this script to brakedown my records by monthIt works but when I try to display the data with "=month(rsMonth("DateApplied"))" I get this errorADODB.Recordset error '800a0cc1' Item cannot be found in the collection corresponding to the requested name or ordinal. " |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2005-01-06 : 08:28:35
|
do SELECT DISTINCT month(DateApplied)) as DateApplied FROM seekersGo with the flow & have fun! Else fight the flow |
 |
|
|
SqlStar
Posting Yak Master
121 Posts |
Posted - 2005-01-06 : 08:31:03
|
| Hi,You have to give alias column name for this part of query "month(DateApplied))". It means your query should be like this:SELECT DISTINCT month(DateApplied)) As Months FROM seekersThen, this statement "=month(rsMonth("DateApplied"))" should be changed like this "=month(rsMonth("Months"))"I hope your problem will solve.:) While we stop to think, we often miss our opportunity :) |
 |
|
|
AndyB13
Aged Yak Warrior
583 Posts |
Posted - 2005-01-06 : 08:38:34
|
| SqlStarWhilst your solution is right, surely spirit1's answer is easier as all that needs to be added is AS DateApplied to the SQL stringJust thought i'd point that out in case it confuses the posterAndy |
 |
|
|
SqlStar
Posting Yak Master
121 Posts |
Posted - 2005-01-06 : 08:41:57
|
| AndyB13,I have not seen the spirit1's answer, while I was writing reply to the poster. I also agree with spirit1's answer.:) While we stop to think, we often miss our opportunity :) |
 |
|
|
AndyB13
Aged Yak Warrior
583 Posts |
Posted - 2005-01-06 : 08:49:51
|
| I know, i had gathered that.My response was for the benefit of the poster to avoid the confusion of which answer was correct which both where:) |
 |
|
|
|
|
|