Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Displaying records in a table after a certain date?

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-07-17 : 09:58:09
Andrew writes "Hi,

I have written a web based application for the intranet of the company i work for. The application functions well, but in the Year to date section i am suppsoed to display all of the records since the beginning of the year in an html table. It displays all of the records regardless of their date. How can i construct/edit my statement to only show records from the last year. Here is the section of code i want to change:



strSQL = "SELECT * FROM TypeList"

rstType.CursorType = 3
rstType.Open strSQL, con

Response.Write("<TR><TD> </TD>")
do while not rstType.EOF
numberoftypes = numberoftypes + 1
Response.Write("<TD><font color=#33995F face='Tahoma' size=2><center>" & rstType("Type") & "</center></font></TD>")
rstType.MoveNext
loop
Response.Write("<TD><font color=#33995F face='Tahoma' size=2><center>Totals</center></font></TD>")
Response.Write("</TR>")
strSQL = "SELECT * FROM ProductList"
rstProd.open strSQL, con
do while not rstProd.EOF
rstType.MoveFirst
Response.Write("<TR>")
Response.Write("<TD><font color=#33995F face='Tahoma' size=2>" & rstProd("ProductName") & "</font></TD>")
do while not rstType.EOF
strSQL = "SELECT * FROM CCRDRProductLink WHERE Product='" & rstProd("ProductName") & "'"
rstCCRDR.Open strSQL, con
do while not rstCCRDR.EOF
strSQL = "SELECT * FROM ConfigurationChangeRequest WHERE RequestNumber='" & rstCCRDR("CCR") & "'"
rstCCR.Open strSQL, con
if rstCCR("ChangeType") = rstType("Type") then
totalForCell = totalForCell + 1
end if
rstCCR.Close
rstCCRDR.MoveNext

Any help would be appreciated,

Andrew."

Nazim
A custom title

1408 Posts

Posted - 2002-07-17 : 10:08:15
Change your sql statemet.

strSQL = "SELECT * FROM TypeList where trndate>='" & fromthedateyouwanttodisplay & "'"



-------------------------
What lies behind you and what lies ahead of you are small matters compared to what lies within you.-Ralph Waldo Emerson
Go to Top of Page
   

- Advertisement -