Latest News

the latest news from our team

Active Server Pages

The following is one example of using Minisoft’s ODBC driver to access HP e3000 Image files from any web browser. This example uses ADO objects to access the driver. The example consists of two files. The first is a form used to request data. The second is the ASP code used to retrieve data.

Download this sample: [ HTTP]


The newasp.html file:

<html>
<head>
<title>Query Form</title>
</head>

<body>

<form action=”MSDB_1.ASP” method=”GET”>
<p><select name=”Param” size=”1″>
<option selected value=”CUSTOMER_NUMBER”>Contact Number</option>
<option value=”CONTACT_NUMBER”>Contact Number</option>
<option value=”LAST_NAME”>Last Name</option>
<option value=”FIRST_NAME”>First Name</option>
</select></p>
<p><input type=”text” size=”20″ name=”Data”></p>
<p><input type=”submit” value=”Button”></p>
</form>

</body>
</html> 


The msdb_1.asp file:

<html>

<head>
<meta HTTP-EQUIV=”Content-Type” CONTENT=”text/html;charset=windows-1252″>
<title>MSDB CONTACTS</title>
</head>

<body>
<%
Param = Request.QueryString(“Param”)
Data = Request.QueryString(“Data”)

‘ Session (global) variable names used in this sample:
‘ MSDB_Conn = Used to store the open connection
‘ between successive calls to
‘ this page.

‘ Local variable names used in this sample:
‘ Param = string value from the form used to call this
‘ page. Used to hold the name of the key to perform
‘ an optional lookup.
‘ Data = string value from the form used to call this
‘ page. Used to hold the value of the key for lookups.
‘ conn = object created from ADO.
‘ sql = string to hold the SQL Select statement.
‘ rs = object used to hold the result set of the
‘ SQL Select.

%>
<%

‘ This section checks to see if a connection has
‘ already been established.
‘ If it has, conn is assigned the old connection. If
‘ not, the connection object is created, assigned to
‘ conn, and the session vaiable created.

If IsObject(Session(“MSDB_conn”)) Then
Set conn = Session(“MSDB_conn”)
Else
Set conn = Server.CreateObject(“ADODB.Connection”)
conn.open “MSDB”
Set Session(“MSDB_conn”) = conn
End If

%>
<%

‘ Here we create the SELECT statement and optionaly
‘ add the criteria.

sql = “SELECT * FROM CONTACTS”
If cstr(Param) <> “” And cstr(Data) <> “” Then
sql = sql & ” WHERE ” & cstr(Param) & ” = ‘” & right(“000000″+trim(cstr(Data)),6) & “‘”
End If
Set rs = Server.CreateObject(“ADODB.Recordset”)
rs.Open sql, conn, 3, 3
%>

<table>
<caption>MSDB CONTACTS</caption>
<THEAD>
<tr>
<th><%=Server.HTMLEncode(rs.Fields(0).Name)%>
</th>
<th><%=Server.HTMLEncode(rs.Fields(1).Name)%>
</th>
<th><%=Server.HTMLEncode(rs.Fields(2).Name)%>
</th>
<th><%=Server.HTMLEncode(rs.Fields(3).Name)%>
</th>
<th><%=Server.HTMLEncode(rs.Fields(4).Name)%>
</th>
<th><%=Server.HTMLEncode(rs.Fields(5).Name)%>
</th>
</tr>
</THEAD>
<TBODY>
<%

‘ For each record in the result set (rs) a row of
‘ the table is added.

On Error Resume Next
rs.MoveFirst
do while Not rs.eof
%>
<tr VALIGN=”TOP”>
<td><%=Server.HTMLEncode(rs.Fields(0).Value)%>
</td>
<td><%=Server.HTMLEncode(rs.Fields(1).Value)%>
</td>
<td><%=Server.HTMLEncode(rs.Fields(2).Value)%>
</td>
<td><%=Server.HTMLEncode(rs.Fields(3).Value)%>
</td>
<td><%=Server.HTMLEncode(rs.Fields(4).Value)%>
</td>
<td><%=Server.HTMLEncode(rs.Fields(5).Value)%>
</td>
</tr>
<%
rs.MoveNext
loop
%>
</TBODY>
<TFOOT>
<tr>
<td colspan=”6″>SQL=&quot;<%=sql%>&quot;</td>
</tr>
</TFOOT>
</table>
</body>
</html>

Leave a Reply

Your email address will not be published. Required fields are marked *