Results 1 to 3 of 3

Thread: Date problem..

  1. #1
    Join Date
    Mar 2003
    Location
    Memphis, TN, USA
    Posts
    61

    Red face Unanswered: Date problem..

    Hi there !!
    Please help me to sort out the error's. I have to submit this assignmnet on monday at any cost.

    I got an assignment where i have to generate 5 html reports .. like Total events per month ( last 6 month), Daily events Analysis ( last 30 days) and so on.. based on campaigns.

    If the user select all campaigns / single/ double comapiagns then i have to show reports accordingly. I have no issue of carrying the campaign information page to respective pages. The issue is on the above mentions reports.

    In Total Events per month( last 6 month) :

    Query 1: How can I get the last 6 month data and header dynamically ?

    Below is the brief snippet code ..What i am doing so far..

    Dim conn,rs,rs1,strsql,strq
    set conn = Server.CreateObject("ADODB.Connection")
    set rs = Server.CreateObject("ADODB.Recordset")
    set rs1 = Server.CreateObject("ADODB.Recordset")
    conn.open "DSN=abc;UID=sqlboy;PWD=sqlboy;DATABASE=sqlboy "

    ' collecting selected campaigns number

    Dim strchecked,acheckarray,iloop, tot
    strchecked = Request.Querystring("camplist")
    aCheckarray = split(strchecked, ",") %>
    <tr bgcolor="#cacaca"><td>Campaign</td>

    ' i want this part dynamically

    <td>Aug 03</td><td>Sep 03</td><td>Oct 03</td><td>Nov 03</td><td>Dec 03</td><td>Jan 04</td>
    <td><b>Total</b></td></tr>

    'fetching records one by one in arrays
    <% For iloop = LBound(aCheckarray) to Ubound(acheckarray)
    strsql="select * from campaigns where campnum = '"& acheckarray(iloop)&"'"
    set rs = conn.execute(strsql) %>

    <tr bgcolor="#ffffff"><td><%=rs("campname")%></td>

    <% For i = 0 to 5 %>
    <% strsq="select count(*) as numeve from events where evenum = '"& Rs("evenum")&"' and '"& datename("mm", evestart) &"' >= '"& datename("mm" , datediff("m",i-5 ,date))&"'"

    set rs1 = conn.execute(strsq)
    evenum = rs1("numeve") %>
    <td><%=evenum %></td>
    <% totc= evenum + totc %>
    <% tot = evenum + tot %>
    <% Next %>
    <td><%=totc %></td>
    </tr>
    <% totc = 0 %>
    <% Next %>
    <tr bgcolor="#ffffff"><td></td><td></td><td></td><td></td><td></td><td><%=tot %></td></tr>
    </table>

    I am getting this error ...

    Microsoft VBScript runtime (0x800A000D)
    Type mismatch: 'datename'

    Please help me..

    With Thanks !!
    Last edited by sqlboy; 01-17-04 at 04:25.

  2. #2
    Join Date
    Jan 2004
    Posts
    4
    Here's a couple of ideas......don't know if they'll help....

    *1 : Check the data type in your DB - is it set to date? - if so try setting it to text

    *2 : I have had problems in the past naming fields with 'date' in the fieldname - spits it out sometimes?

    Stretch

  3. #3
    Join Date
    Mar 2003
    Location
    Memphis, TN, USA
    Posts
    61
    Thanks !! I sorted out the problem.. before you marked your response.
    I keen to know.. how i can generate the last 6 month header dynamically ? viz..

    Aug 03 | Sep 03 |Oct 03 | Nov 03 |Dec 03 | Jan 04 |

    Obviously, it based on current date.

    With thanks

Posting Permissions

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