R
riyaz
i am creating a asp page where i want to display records based upon the
following condition ,i have tried but i cant get it.
condition:
check the current date is with in the limits of the fdate & tdate ,if yes
then display corresponding row of records.
this is My table(display) :
fdate tdate Announcement Event Discussion
4/10/2006 4/30/2006 sampletext1 sampletext2 sampletext3
5/1/2006 5/30/2006 phrase1 phrase2 phrase3
i want to display the records for the period of days ,Dynamically it should
change records after the date end.
for example: today is 4/22/2006 , so page must display the first row as it
satisfies the condition..
i have wrote the code for displaying one field,but it does not work.
my code is:
<%
Dim cn,rs
Dim sDate ' current date from the page
Set cn = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.Recordset")
cn.Provider = "MicroSoft.jet.OLEDB.4.0"
cn = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Inetpub\wwwroot\webap\test.mdb"
rs.Open "display",cn,3,3
sDate=Request.Form("Tcdate")
%>
<%
Do While Not rs.EOF
If sDate>=rs("fdate") AND sDate<=rs("tdate") Then
Response.Write rs("Announcement")
end if
rs.MoveNext
loop
%>
<%
rs.close
set rs=nothing
%>
please help me to correct my code
thanks & regards
Niyaz
following condition ,i have tried but i cant get it.
condition:
check the current date is with in the limits of the fdate & tdate ,if yes
then display corresponding row of records.
this is My table(display) :
fdate tdate Announcement Event Discussion
4/10/2006 4/30/2006 sampletext1 sampletext2 sampletext3
5/1/2006 5/30/2006 phrase1 phrase2 phrase3
i want to display the records for the period of days ,Dynamically it should
change records after the date end.
for example: today is 4/22/2006 , so page must display the first row as it
satisfies the condition..
i have wrote the code for displaying one field,but it does not work.
my code is:
<%
Dim cn,rs
Dim sDate ' current date from the page
Set cn = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.Recordset")
cn.Provider = "MicroSoft.jet.OLEDB.4.0"
cn = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Inetpub\wwwroot\webap\test.mdb"
rs.Open "display",cn,3,3
sDate=Request.Form("Tcdate")
%>
<%
Do While Not rs.EOF
If sDate>=rs("fdate") AND sDate<=rs("tdate") Then
Response.Write rs("Announcement")
end if
rs.MoveNext
loop
%>
<%
rs.close
set rs=nothing
%>
please help me to correct my code
thanks & regards
Niyaz