riyaz
Fri Apr 21 03:12:01 CDT 2006
i have tried , now i have changed the condition
My table :
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/21/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
"Stefan B Rusynko" wrote:
> From the location you appear to be running localhost in IIS under FP in a subweb named webap
> - if not running localhost (
http://localhost/webap/ your ASP won't work
> You need the DB in a folder w/ appropriate permissions (you have it in the root of the subweb webap)
> Open your FP subweb
> Select sample.mdb & File export it to your desktop, then delete it from the FP subweb
> The File Import it into your subweb and let FP put it in the fpdb folder and set up the required permissions and set up your
> global.asa
> Check the DB connect in Tools Site Settings Database
> Look in global.asa and you will see the correct connection string as something like
> Application("yourdbname_ConnectionString")
>
> Then replace
> Set cn = Server.CreateObject("ADODB.Connection")
> cn.Provider = "MicroSoft.jet.OLEDB.4.0"
> cn.Open "C:\Inetpub\wwwroot\webap\sample.mdb"
> Set rs = Server.CreateObject("ADODB.Recordset")
> rs.Open "Friends",cn,3,3
>
>
> With
> cn_Name = Application("yourdbname_ConnectionString")
> Set cn = Server.CreateObject("ADODB.Connection")
> Set rs = Server.CreateObject("ADODB.RecordSet")
> rs.Open "Friends", cn_Name, 3 ,3
>
> Suggest you review SQL and ADO DB connections at
>
http://www.w3schools.com/default.asp
>
> --
>
> _____________________________________________
> SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
> "Warning - Using the F1 Key will not break anything!" (-;
> To find the best Newsgroup for FrontPage support see:
>
http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
> _____________________________________________
>
>
> "riyaz" <riyaz@discussions.microsoft.com> wrote in message news:DE5254F2-77FA-4421-AFAC-91DB79BBE0F6@microsoft.com...
> |
> | hi stefan
> |
> | i am getting the following error message when i run the page
> |
> | "Microsoft JET Database Engine (0x80004005)
> | The Microsoft Jet database engine cannot open the file
> | 'C:\Inetpub\wwwroot\webap\sample.mdb'. It is already opened exclusively by
> | another user, or you need permission to view its data.
> | /webap/default1.asp, line 71"
> |
> | this is my connection string
> |
> | <%
> |
> | Dim cn,rs,sql
> |
> | Set cn = Server.CreateObject("ADODB.Connection")
> | Set rs = Server.CreateObject("ADODB.Recordset")
> |
> |
> | cn.Provider = "MicroSoft.jet.OLEDB.4.0"
> | cn.Open "C:\Inetpub\wwwroot\webap\sample.mdb"
> | rs.Open "Friends",cn,3,3
> |
> |
> | Response.Write "<Table width=400>"
> | Response.Write "<TR>"
> | Response.Write "<TD><b>Info</b></TD><TD><b>First Name</b></TD>"
> | Response.Write "<TD><b>Last Name</b></TD><TD><b>Email</b></TD>"
> | Response.Write "</TR>"
> |
> | Do While Not rs.EOF
> | Response.Write "<TR>"
> | Response.Write rs("Name") & """>Info</a></td>"
> | Response.Write "<TD>" & rs("Link") & "</TD><TD>"
> | Response.Write "</TR>"
> | Rs.MoveNext
> | Loop
> |
> | Response.Write "</Table>"
> |
> |
> | %>
> |
> |
> | since i have closed the database i am getting this error.please help me to
> | correct the code.
> |
> |
> | Thanks & regards
> | Niyaz
> |
> | "Stefan B Rusynko" wrote:
> |
> | > Invalid syntax
> | > See
http://www.w3schools.com/asp/default.asp
> | >
> | > If Date() => Cdate("2/23/2006") AND Data() <= Cdate("2/28/2006") Then
> | > 'show data from table_currentdata .
> | > ElseIf Date() => Cdate("2/29/2006") AND Data() <= Cdate("3/29/2006") Then
> | > 'show data from table_newdata
> | > Else
> | > 'show something else or error message
> | > End If
> | > --
> | >
> | > _____________________________________________
> | > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
> | > "Warning - Using the F1 Key will not break anything!" (-;
> | > To find the best Newsgroup for FrontPage support see:
> | >
http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
> | > _____________________________________________
> | >
> | >
> | > "riyaz" <riyaz@discussions.microsoft.com> wrote in message news:AFB0C9E8-3615-4A2D-87F7-CBB094EB620A@microsoft.com...
> | > | hi
> | > |
> | > | i am new to asp programming, actually i am trying to create a dynamic asp
> | > | page in which the contents that i am showing in the page must change
> | > | according to the date i have given in the program..
> | > | like this:
> | > |
> | > | i am using MS-access database,, Asp
> | > |
> | > | if date is "23/2/2006 to 28/2/2006" show data from table_currentdata .
> | > |
> | > | else
> | > |
> | > | if date " 29/2/2006 between 29/3/2006" then show data from table_newdata
> | > |
> | > |
> | > | endif
> | > |
> | > | please help me with the coding for this condition.
> | > |
> | > | regards
> | > | Riyaz
> | > |
> | > | riyazny@gmail.com
> | >
> | >
> | >
>
>
>