SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Sep 2003
    Location
    Australia
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Having ASP problems with an advanced SQL statement

    Hi All,

    I am trying to track down where the error is.

    Below is the code that I am working on:

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

    SQL = "CREATE TABLE #t (WeekData INT); insert into #t select DatePart(ww, SubmitDate) from support where DatePart(yyyy, SubmitDate) = 2003 and DatePart(mm, SubmitDate) = 6; CREATE TABLE #t2 (JobNumbers INT); insert into #t2 select Count(WeekData) from #t group by WeekData; select * from #t2;"

    rst.open SQL, oConn, adOpenStatic
    %>

    <FONT SIZE="5" COLOR=""><B>Weekly job average/B> <%=rst(0)%><%=rst(0)%></FONT><br><br>

    <%
    rst.close
    %>
    ---------------------------------

    Essential what I am trying to do is take some records that are in a particular month and then find what the weekly average is. To do this I have had to create a couple of temporary tables to house the data. When I run the above SQL statement in SQL Auery Analyser (comes with SQL server) I get correct information but when I put it into my ASP code I get the follow error:

    ADODB.Recordset error '800a0cc1'

    Item cannot be found in the collection corresponding to the requested name or ordinal.

    /apps/support/report.asp, line 78

    Now the line that it is falling over on is where the <%=rst(0)%>, and from what I have read the error message means that it can't find the field in the table.

    Am I trying to use SQL that will not work with ASP or am I missing something.

    Thanks.

  2. #2
    SitePoint Wizard dethfire's Avatar
    Join Date
    Aug 2000
    Posts
    2,477
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That error is commonly used as well when you mispell tables or fields that don't exist
    Free Science Homework Help
    http://www.physicsforums.com


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •