Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsOtherProgramming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old February 2nd, 2005, 06:56 AM
jheinzman jheinzman is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 4 jheinzman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 40 m 11 sec
Reputation Power: 0
Exclamation Sql to Asp Problem.

I'm having a problem getting something to work in ASP that works using TOAD. The code is below. It works in ASP until I get to the union statement, then I get error messages, like this one: Item cannot be found in the collection corresponding to the requested name or ordinal. When I make changes, I'll get a variety of other error messages. Again, this works using toad for oracle, but gets lost in the translation to vb script.

This is an operator log entry database. Some of the log entries are annotated. The connection to the original entry is the entry timestamp. Annotations have an annotation number greater than 0. 0 is used for the original entry and annotations are 1,2,3...
I want to place the word annotation at the start of an annotation entry, have the entry appear just below the original log entry and order the annotations by annotation number 1,2,3... Any help would be appreciated.

The line highlighted in red is causing the problem.

SQL = " SELECT ENTRY_TEXT"
SQL = SQL & " ,SHIFT_DATE"
SQL = SQL & " ,ENTRY_TIME"
SQL = SQL & " , ENTRY_TIMESTAMP"
SQL = SQL & " , ANNOTATION_TIMESTAMP"
SQL = SQL & " , ANNOTATION_NUMBER"
SQL = SQL & " , OPERATOR_POSITION_DESCR"
SQL = SQL & " , ENTRY_TIME "
SQL = SQL & " FROM LOG_ENTRIES"
SQL = SQL & " WHERE SHIFT_DATE = TO_DATE('01272005', 'MMDDYYYY') "
SQL = SQL & " AND SHIFT_ID = 1"
SQL = SQL & " AND LOG_ID = 1"
SQL = SQL & " AND ANNOTATION_NUMBER = 0"
SQL = SQL & " UNION"
SQL = SQL & " SELECT 'ANNOTATION----'||A.ENTRY_TEXT"
SQL = SQL & " ,A.SHIFT_DATE"
SQL = SQL & " ,A.ENTRY_TIME"
SQL = SQL & " , A.ENTRY_TIMESTAMP"
SQL = SQL & " , A.ANNOTATION_TIMESTAMP"
SQL = SQL & " , A.ANNOTATION_NUMBER "
SQL = SQL & " , B.ENTRY_TIME"
SQL = SQL & " FROM LOG_ENTRIES A"
SQL = SQL & " , LOG_ENTRIES B"
SQL = SQL & " WHERE A.SHIFT_DATE = TO_DATE('01272005', 'MMDDYYYY') "
SQL = SQL & " AND A.SHIFT_ID = 1"
SQL = SQL & " AND A.LOG_ID = 1"
SQL = SQL & " AND A.ANNOTATION_NUMBER > 0"
SQL = SQL & " AND B.SHIFT_DATE = A.SHIFT_DATE"
SQL = SQL & " AND B.LOG_ID = A.LOG_ID"
SQL = SQL & " AND B.ENTRY_TIMESTAMP = A.ENTRY_TIMESTAMP"
SQL = SQL & " AND B.ANNOTATION_NUMBER = 0"
SQL = SQL & " ORDER BY 2,7, 5, 6 "

Last edited by jheinzman : February 2nd, 2005 at 07:53 AM. Reason: Forgot the error code

Reply With Quote
  #2  
Old February 2nd, 2005, 08:10 AM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,770 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 7 h 4 m 46 sec
Reputation Power: 469
Quote:
Item cannot be found in the collection corresponding to the requested name or ordinal

This message means you are referring to a column name that doesn't exist, make sure the column name exists and that it is spelled correctly.

Reply With Quote
  #3  
Old February 2nd, 2005, 08:12 AM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,770 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 7 h 4 m 46 sec
Reputation Power: 469
Have you tried this
Code:
SQL = SQL & " , OPERATOR_POSITION_DESCR As Entry_Time"

Reply With Quote
  #4  
Old March 15th, 2005, 10:32 AM
DaveGerard DaveGerard is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 3 DaveGerard User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 28 m 27 sec
Reputation Power: 0
Not sure if this is what you're looking for, but it should get you close. I didn't test it out so there might be a little tweaking on your end. Let me know how it works.

Dave

'=====================

SQL = " SELECT"
SQL = SQL & " NULL AS Annotation,"
SQL = SQL & " A.SHIFT_DATE AS ShiftDate,"
SQL = SQL & " A.ENTRY_TIME AS EntryTime,"
SQL = SQL & " A.ENTRY_TIMESTAMP AS EntryTimestamp,"
SQL = SQL & " A.ANNOTATION_TIMESTAMP AS AnnotationTimestamp,"
SQL = SQL & " A.ANNOTATION_NUMBER AS AnnotationNumber,"
SQL = SQL & " A.OPERATOR_POSITION_DESCR AS OperatorPositionDescription"
SQL = SQL & " FROM LOG_ENTRIES A"
SQL = SQL & " WHERE A.SHIFT_DATE = '01/27/2005'"
SQL = SQL & " AND A.SHIFT_ID = 1"
SQL = SQL & " AND A.LOG_ID = 1"
SQL = SQL & " AND A.ANNOTATION_NUMBER = 0"

SQL = SQL & " UNION ALL"

SQL = SQL & " SELECT"
SQL = SQL & " B.ENTRY_TEXT AS Annotation,"
SQL = SQL & " B.SHIFT_DATE AS ShiftDate,"
SQL = SQL & " B.ENTRY_TIME AS EntryTime,"
SQL = SQL & " B.ENTRY_TIMESTAMP AS EntryTimestamp,"
SQL = SQL & " B.ANNOTATION_TIMESTAMP AS AnnotationTimestamp,"
SQL = SQL & " B.ANNOTATION_NUMBER AS AnnotationNumber,"
SQL = SQL & " B.OPERATOR_POSITION_DESCR AS OperatorPositionDescription"
SQL = SQL & " FROM LOG_ENTRIES B"
SQL = SQL & " WHERE B.SHIFT_DATE = '01/27/2005'"
SQL = SQL & " AND B.SHIFT_ID = 1"
SQL = SQL & " AND B.LOG_ID = 1"
SQL = SQL & " AND B.ANNOTATION_NUMBER > 0"

SQL = SQL & " ORDER BY AnnotationNumber"

Reply With Quote
Reply

Viewing: ASP Free ForumsOtherProgramming Help > Sql to Asp Problem.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT