a webmaster learning community
     Home    Register     Search      Help      Login    
FrontPage Alternative
Sponsors

Hosting from $3.99 per month!

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions. dd

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

Problems with Query using date functions

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> Problems with Query using date functions
Page: [1]
 
adam2804

 

Posts: 34
Joined: 6/6/2006
Status: offline

 
Problems with Query using date functions - 7/18/2006 7:19:14   
Hello all,

Can anyone spot a problem with this query?

<!--webbot bot="DatabaseRegionStart" s-columnnames="Scans" s-columntypes="5" s-dataconnection="BureauManagerSQL" b-tableformat="TRUE" b-menuformat="FALSE" s-menuchoice="Scans" s-menuvalue="Scans" b-tableborder="FALSE" b-tableexpand="FALSE" b-tableheader="FALSE" b-listlabels="TRUE" b-listseparator="TRUE" i-listformat="0" b-makeform="FALSE" s-recordsource s-displaycolumns="Scans" s-criteria s-order s-sql="SELECT     SUM(dbo.WorkDetails.Quantity) AS Scans<br>FROM         dbo.WorkDetails INNER JOIN<br>                      dbo.WorkType ON dbo.WorkDetails.WorkType = dbo.WorkType.WorkType<br>WHERE     (dbo.WorkType.JobType_ID = 'S')<br>GROUP BY dbo.WorkDetails.SiteID, { fn DAYOFYEAR(dbo.WorkDetails.WorkDate) }, YEAR(dbo.WorkDetails.WorkDate)<br>HAVING      (YEAR(dbo.WorkDetails.WorkDate) = YEAR({ fn NOW() })) AND (dbo.WorkDetails.SiteID = '5') AND ({ fn DAYOFYEAR(dbo.WorkDetails.WorkDate) <br>                      } = { fn DAYOFYEAR({ fn NOW() }) })" b-procedure="FALSE" clientside suggestedext="asp" s-defaultfields s-norecordsfound="No records returned." i-maxrecords="0" i-groupsize="0" botid="5" u-dblib="../../_fpclass/fpdblib.inc" u-dbrgn1="../../_fpclass/fpdbrgn1.inc" u-dbrgn2="../../_fpclass/fpdbrgn2.inc" tag="TBODY" preview="<tr><td colspan=64 bgcolor="#FFFF00" width="100%"><font color="#000000">This is the start of a Database Results region.</font></td></tr>" b-UseDotNET="FALSE" CurrentExt sa-InputTypes b-DataGridFormat="FALSE" b-DGridAlternate="TRUE" sa-CritTypes b-WasTableFormat="TRUE" startspan --><!--#include file="../../_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT     SUM(dbo.WorkDetails.Quantity) AS Scans FROM         dbo.WorkDetails INNER JOIN                       dbo.WorkType ON dbo.WorkDetails.WorkType = dbo.WorkType.WorkType WHERE     (dbo.WorkType.JobType_ID = 'S') GROUP BY dbo.WorkDetails.SiteID, { fn DAYOFYEAR(dbo.WorkDetails.WorkDate) }, YEAR(dbo.WorkDetails.WorkDate) HAVING      (YEAR(dbo.WorkDetails.WorkDate) = YEAR({ fn NOW() })) AND (dbo.WorkDetails.SiteID = '5') AND ({ fn DAYOFYEAR(dbo.WorkDetails.WorkDate)                        } = { fn DAYOFYEAR({ fn NOW() }) })"
fp_sDefault=""
fp_sNoRecords="<tr><td colspan=1 align=""LEFT"" width=""100%"">No records returned.</td></tr>"
fp_sDataConn="BureauManagerSQL"
fp_iMaxRecords=0
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice="Scans"
fp_sMenuValue="Scans"
fp_sColTypes="&Scans=5&"
fp_iDisplayCols=1
fp_fCustomQuery=True
BOTID=5
fp_iRegion=BOTID
%>
<!--#include file="../../_fpclass/fpdbrgn1.inc"-->
<!--webbot bot="DatabaseRegionStart" endspan i-checksum="4786" -->


It works fine on SQL server when I run it there but doesn't return any results when I try to use it in Front Page. Just wondering if anyone can spot anything? Thanks in advance

Adam
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: Problems with Query using date functions - 7/18/2006 8:08:58   
How 'bout leaving it on SQL Server as a View or Stored Procedure and call that instead?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to adam2804)
adam2804

 

Posts: 34
Joined: 6/6/2006
Status: offline

 
RE: Problems with Query using date functions - 7/18/2006 8:22:50   
Fantastic idea!

Although it wasn't that in the end (it was because I was working with the test database, which doesn't have any 'current' data on it) so when querying 'this months' data it wouldn't return anything. Although using your idea I found that out!

So, thanks!

(in reply to rdouglass)
Page:   [1]
OutFront Discoveries

All Forums >> Web Development >> ASP and Database >> Problems with Query using date functions
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts