DBPix Sample Source Code: default.asp Back to sample
<%@ LANGUAGE = VBScript %>
<%
' Ensure that the client-browser doesn't cache
Response.Expires = -1
Response.Buffer = TRUE
Response.Clear
Response.cachecontrol = "private"
Response.AddHeader "pragma", "no-cache"
%>
<html><head><title>ASP Image Database Samples - Remote Editing with XMLHTTP</title>
<!--#include file="adovbs.inc" --><!-- *** Defines various constants for VBScipt database operations *** -->
<!--#include file="config.inc" --><!-- *** App specifig configuration, connect strings, database locations/DSN's etc *** -->
<!--#include file="common.inc" --><!-- *** common code *** -->
<style type="text/css">
a.editlink:link {color:#FF0000; font-weight:bold; display:block;}
a.editlink:active {color:#FF0000; font-weight:bold; display:block;}
a.editlink:visited {color:#FF0000; font-weight:bold; display:block;}
a.editlink:hover {color:#0000FF; font-weight:bold; display:block;}
</style>
</head>
<body topmargin="0" leftmargin="0">
<table width="100%" border="0" cellpadding="5" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td align=center><font face="Arial" size="4" color="#003366"><strong><u>ASP Image Database Samples - Remote Editing with XMLHTTP</u></strong></font>
</td>
</tr>
<tr>
<td><table border="0" cellpadding="0" cellspacing="0">
<%
Dim strPageLinks
Dim PageSize
Dim Page
PageSize = 10
if Request.QueryString("pg")="" then
Page = 1
else
Page = cint(Request.QueryString("pg"))
end if
Set cn = Server.CreateObject("ADODB.Connection")
cn.Open GetConnectString
sqlselect = "SELECT Id, ImageId, DateChanged, Title, Description, ImgWidth, ImgHeight, ImgSize, ThmWidth, ThmHeight " &_
"FROM tItems " &_
"ORDER BY DateChanged DESC"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.CursorLocation = 3 'clientside
rs.CursorType = 3 'staticrecordset
rs.PageSize = PageSize
rs.Open sqlselect, cn, adOpenForwardOnly, adLockReadOnly, adCmdText
' Generate table of links to pages 1, 2, 3 etc
strPageLinks = "<table border=""0"" cellpadding=""2"" cellspacing=""0""><tr>"
for i=1 to rs.PageCount
if i = Page then
strPageLinks = strPageLinks + "<td><font face=Arial color=#003366 size=3><strong>" & i & "</strong></font> </td>"
else
strPageLinks = strPageLinks + "<td><font face=Arial color=#003366 size=3><strong><a href=default.asp?pg=" & i & ">" & i & "</a></strong></font> </td>"
end if
next
strPageLinks = strPageLinks + "</tr></table>"
%>
<tr>
<td colspan="4" align=center><font face="Arial" size="2" color="#003366"><strong><a href="readme.htm">Documentation</a> <!--<a href="simpasp.zip">Download</a> --><a href="http://www.ammara.com/">DBPix Site</a><strong></font><hr size=1>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" width="33%"> </td>
<td align="center" width="33%"><%=strPageLinks%></td>
<td align="right" width="34%"><font face="Arial" color="#003366" size="2"><strong><a href="item_edit.asp?itemid=0" border="0" class="editlink">Add New</a></strong></font></td>
</tr>
</table><hr size=1>
</td>
</tr>
<%
Dim ImageUrl
Dim Count
Count = 1
if not rs.EOF and not rs.BOF then
rs.AbsolutePage = Page
End If
while not rs.EOF and Count <= PageSize
%>
<tr>
<td rowspan="2" align="center" valign="top"><%
if rs("ThmWidth") < 1 then%>
<font face="Arial" color="#003366" size="2"><strong><br><br>No Image</strong></font><%
else%>
<%=StartImageBorder%><a href="item_detail.asp?itemid=<%=rs("Id")%>" border="0"><img src="getthumb.asp?itemid=<%=rs("Id")%>&imgid=<%=rs("ImageId")%>" width="<%=rs("ThmWidth")%>" height="<%=rs("ThmHeight")%>" alt="Click thumbnail for large picture" border="0"></a><%=FinishImageBorder%><%
end if
%> </td>
<td rowspan="2" align="left" valign="top"><img src="images/transparent.gif" width="10" height="1" alt="spacer"></td>
<td colspan="2" align="left" valign="top" width="400"><font face="Arial" color="#003366" size="2"><strong>Title: </strong></font>
<font face="Arial" size="2"><%=rs("Title")%></font><br><br>
<font face="Arial" color="#003366" size="2"><strong>Description: </strong></font><br>
<font face="Arial" size="2"><%=rs("Description")%></font>
</td>
</tr>
<tr>
<td align="left" valign="bottom"><font face="Arial" color="#003366" size="2"><strong><a href="item_detail.asp?itemid=<%=rs("Id")%>" border="0">Details</a></strong></font></td>
<td align="right" valign="bottom"><font face="Arial" color="#003366" size="2"><strong><a href="item_edit.asp?itemid=<%=rs("Id")%>" border="0" class="editlink">Edit</a></strong></font></td>
</tr>
<tr><td colspan="4"><hr size="1"></td></tr>
<%
rs.MoveNext
Count = Count + 1
wend
%>
<tr><td colspan="4" align="center"><%=strPageLinks%><hr size="1"></td></tr>
</table>
</td>
</tr>
</table>
</body>
</html>
Back to sample
|