R
riyaz
I am trying to display records depend on the current date & check with
database to display it in asp page.
for the below code i try to display records of "Announcement" field only by
checking the todays date
in the table by using the condition..by using this code it does not returns
any records from table
this is my MS-Acess database table:
fdate tdate Announcement Event Discussion
4/10/2006 4/30/2006 phrase1 phrase2 phrase3
1/5/2006 10/5/2006 text1 text2 text3
this is the code:
<%
Dim cn,rs
Dim sDate
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
IF IsDate(Request.Form("Tcdate")) Then sDate=Cdate(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
%>
This is code by which i am getting the current date:
<input type="hidden" name="Tcdate" size="14" value="<%=Date()%>">
please help me to do this, any problem with database..
regards
Niyaz
database to display it in asp page.
for the below code i try to display records of "Announcement" field only by
checking the todays date
in the table by using the condition..by using this code it does not returns
any records from table
this is my MS-Acess database table:
fdate tdate Announcement Event Discussion
4/10/2006 4/30/2006 phrase1 phrase2 phrase3
1/5/2006 10/5/2006 text1 text2 text3
this is the code:
<%
Dim cn,rs
Dim sDate
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
IF IsDate(Request.Form("Tcdate")) Then sDate=Cdate(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
%>
This is code by which i am getting the current date:
<input type="hidden" name="Tcdate" size="14" value="<%=Date()%>">
please help me to do this, any problem with database..
regards
Niyaz