If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Date problem..

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-17-04, 03:22
sqlboy sqlboy is offline
Registered User
 
Join Date: Mar 2003
Location: Memphis, TN, USA
Posts: 61
Red face 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 03:25.
Reply With Quote
  #2 (permalink)  
Old 01-19-04, 18:12
stretch stretch is offline
Registered User
 
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
Reply With Quote
  #3 (permalink)  
Old 01-20-04, 00:24
sqlboy sqlboy is offline
Registered User
 
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On