Article View: borland.public.delphi.database.dotnet
Article #26Help with ASP translation
From: Benedictum
Date: Thu, 08 Feb 2007 18:48
Date: Thu, 08 Feb 2007 18:48
220 lines
5856 bytes
5856 bytes
I was asked to revamped an ASP web page using Delphi2006. I have the
following code:
//*****************
<%
Dim xConn
Dim xrs
Dim strConn
Dim strsql
Dim sPrevCategory
' Get connection string
strConn = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA
SOURCE=\\premfs2\sites\Premium7\bgr5678\database\diamond.mdb;Persist
Security Info=False"
' Open connection to the database
set xConn = Server.CreateObject("ADODB.Connection")
xConn.Open strConn
' Build the query
strsql = "SELECT * FROM Event LEFT JOIN EventCategory ON
[Event].[CategoryCd]=[EventCategory].[CategoryCd] WHERE Now() BETWEEN
EventDateStart AND EventDateEnd ORDER BY [SortSeq], [EventDate1]"
' Open recordset
set xrs = Server.CreateObject("ADODB.Recordset")
xrs.Open strsql, xConn
' Loop out the HTML
sPrevCategory = ""
Do While (NOT xrs.EOF)
if sPrevCategory <> xrs("EventCategory.Title") then
sPrevCategory = xrs("EventCategory.Title")
Response.Write("<tr><td class=""ddsGridHdr""><h3>")
Response.Write xrs("EventCategory.Title")
Response.Write("</h3>")
if len(xrs("EventCategory.Description")) > 0 Then
Response.Write("<span class=""ddsFootnote"">")
Response.Write xrs("EventCategory.Description")
Response.Write("</span>")
end if
Response.Write("</td></tr>")
end if
Response.Write("<tr><td class=""ddsGridTag""><h4>")
Response.Write xrs("Event.Title")
Response.Write("</h4>")
if len(xrs("Description")) > 0 Then
Response.Write("<p class=""ddsIndentedParagraph"">")
Response.Write xrs("Description")
Response.Write("</p>")
end if
Response.Write("<ul>")
if len(xrs("Host")) > 0 Then
Response.Write("<li>")
Response.Write xrs("Host")
Response.Write("</li>")
end if
if len(xrs("TimeDescription")) > 0 Then
Response.Write("<li>")
Response.Write xrs("TimeDescription")
Response.Write("</li>")
end if
if len(xrs("PriceDescription")) > 0 Then
Response.Write("<li>")
Response.Write xrs("PriceDescription")
Response.Write("</li>")
end if
if len(xrs("Bullet1")) > 0 Then
Response.Write("<li>")
Response.Write xrs("Bullet1")
Response.Write("</li>")
end if
if isdate(xrs("EventDate1")) Then
Response.Write("<li>")
Response.Write FormatDateTime(xrs("EventDate1"),1)
Response.Write("</li>")
end if
if len(xrs("Bullet2")) > 0 Then
Response.Write("<li>")
Response.Write xrs("Bullet2")
Response.Write("</li>")
end if
if isdate(xrs("EventDate2")) Then
Response.Write("<li>")
Response.Write FormatDateTime(xrs("EventDate2"),1)
Response.Write("</li>")
end if
if len(xrs("Bullet3")) > 0 Then
Response.Write("<li>")
Response.Write xrs("Bullet3")
Response.Write("</li>")
end if
if isdate(xrs("EventDate3")) Then
Response.Write("<li>")
Response.Write FormatDateTime(xrs("EventDate3"),1)
Response.Write("</li>")
end if
if len(xrs("Bullet4")) > 0 Then
Response.Write("<li>")
Response.Write xrs("Bullet4")
Response.Write("</li>")
end if
if isdate(xrs("EventDate4")) Then
Response.Write("<li>")
Response.Write FormatDateTime(xrs("EventDate4"),1)
Response.Write("</li>")
end if
if len(xrs("Bullet5")) > 0 Then
Response.Write("<li>")
Response.Write xrs("Bullet5")
Response.Write("</li>")
end if
if isdate(xrs("EventDate5")) Then
Response.Write("<li>")
Response.Write FormatDateTime(xrs("EventDate5"),1)
Response.Write("</li>")
end if
if len(xrs("Bullet6")) > 0 Then
Response.Write("<li>")
Response.Write xrs("Bullet6")
Response.Write("</li>")
end if
if isdate(xrs("EventDate6")) Then
Response.Write("<li>")
Response.Write FormatDateTime(xrs("EventDate6"),1)
Response.Write("</li>")
end if
if len(xrs("Bullet7")) > 0 Then
Response.Write("<li>")
Response.Write xrs("Bullet7")
Response.Write("</li>")
end if
if isdate(xrs("EventDate7")) Then
Response.Write("<li>")
Response.Write FormatDateTime(xrs("EventDate7"),1)
Response.Write("</li>")
end if
if len(xrs("Bullet8")) > 0 Then
Response.Write("<li>")
Response.Write xrs("Bullet8")
Response.Write("</li>")
end if
if isdate(xrs("EventDate8")) Then
Response.Write("<li>")
Response.Write FormatDateTime(xrs("EventDate8"),1)
Response.Write("</li>")
end if
if len(xrs("Bullet9")) > 0 Then
Response.Write("<li>")
Response.Write xrs("Bullet9")
Response.Write("</li>")
end if
if isdate(xrs("EventDate9")) Then
Response.Write("<li>")
Response.Write FormatDateTime(xrs("EventDate9"),1)
Response.Write("</li>")
end if
xrs.MoveNext
Loop
Response.Write("</ul>")
Response.Write("</td></tr>")
' Close
xrs.Close
Set xrs = Nothing
xConn.Close
Set xConn = Nothing
%>
</table>
//*******************************
I need to know what assemblies to reference and how to declare the
vars(types?) and components used. Any help is appreciated.
Thanks,
B
Technical Details
Message-ID:
<45cb7078$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 1effe6,9e91202acc2154d3,start X-Google-Attributes: gid1effe6,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Benedictum" <Benedictus@DominusVobis.com> Newsgroups: borland.public.delphi.database.dotnet Subject: Help with ASP translation Date: Thu, 8 Feb 2007 12:48:32 -0600 Lines: 222 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3028 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 NNTP-Posting-Host: 67.175.16.175 Message-ID: <45cb7078$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1170960504 67.175.16.175 (8 Feb 2007 10:48:24 -0800) Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail