Home
DBPix
Download
Order
Testimonials
Support
Tutorials
Samples
KnowledgeBase
Links
Revision History
Documentation
Search
Contact
Site Map

Graph: DBPix image storage vs OLE Embedding and Linking in Microsoft Access


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;  }
a.editlink:active {color:#FF0000;  font-weight:bold;  }
a.editlink:visited {color:#FF0000;  font-weight:bold;  }
a.editlink:hover {color:#0000FF;  font-weight:bold;  }
</style>
</head>
<body topmargin="10" leftmargin="0"><center>
<p align="center"><font face="Arial" size="4" color="#003366"><strong><u>ASP Image Database Samples - Remote Editing with XMLHTTP</u></strong></font></p>
<p align="center"><font face="Arial" size="2" color="#003366"><strong><a href="readme.htm">Documentation</a> &nbsp; <a href="http://www.ammara.com/">DBPix Site</a><strong></font></p>
<table border="0" cellpadding="0" cellspacing="0" width="600">
<%
  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, ImageVersion, DateChanged, Title, Description, ImgWidth, ImgHeight, ImgSize, ThmWidth, ThmHeight " &_
              "FROM tItems " &_
              "ORDER BY Id"

  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>&nbsp;</td>"
    else
      strPageLinks = strPageLinks + "<td><font face=Arial color=#003366 size=3><strong><a href=default.asp?pg=" & i & ">" & i & "</a></strong></font>&nbsp;</td>"
    end if
  next
  strPageLinks = strPageLinks + "</tr></table>"
%>
  <tr>
    <td colspan="3" align=center><hr size=1>
      <table border="0" cellpadding="0" cellspacing="0" width="100%">
        <tr>
          <td align="left" width="33%">&nbsp;</td>
          <td align="center" width="34%"><%=strPageLinks%></td>
          <td align="right" width="33%"><font face="Arial" color="#003366" size="2"><strong><a href="item_edit.asp?itemid=0&retpg=<%=Page%>" border="0" class="editlink">Add New</a></strong></font></td>
        </tr>
      </table><hr size=1>
    </td>
  </tr>
<%
  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="getimage.asp?query=2&itemid=<%=rs("Id")%>&version=<%=rs("ImageVersion")%>" width="<%=rs("ThmWidth")%>" height="<%=rs("ThmHeight")%>" alt="Click thumbnail for large picture" border="0"></a><%=FinishImageBorder%><%
    end if
%>
    </td>
    <td rowspan="2">&nbsp;&nbsp;</td>
    <td align="left" valign="top" width="100%"><font face="Arial" size="2"><font color="#003366"><strong>Title: </strong></font><%=rs("Title")%><br><br>
      <font color="#003366"><strong>Description: </strong></font><br>
      <%=rs("Description")%></font>
    </td>
  </tr>
  <tr>
    <td nowrap align="right" valign="bottom"><font face="Arial" size="2"><strong><a href="item_detail.asp?itemid=<%=rs("Id")%>">Details</a>&nbsp;&nbsp;
		<a href="item_edit.asp?itemid=<%=rs("Id")%>&retpg=<%=Page%>" border="0" class="editlink">Edit</a></strong></font>
	</td>
  </tr>
  <tr><td colspan="3"><hr size="1"></td>
	</tr>
<%
    rs.MoveNext
    Count = Count + 1
  wend
%>
  <tr>
    <td colspan="3" align="center"><%=strPageLinks%><hr size="1"></td>
	</tr>
</table>
</center>
</body>
</html>

Back to sample