StarQuest Technical Documents
Sample ASP Script for use with Microsoft IIS
Last Update: 16 October 2008
Product: StarSQL
Versions: 5.x
Article ID: SQV00SQ043
Abstract
The sample ASP script that shows you how to connect to your DB2 with StarSQL.
Solution
<%@ LANGUAGE="VBSCRIPT" %>
<HTML>
<HEAD>
<TITLE>StarQuest ASP Sample</TITLE>
</HEAD>
<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DB2DSN", "DB2USER", "PASSWORD"
Set RS = Conn.Execute("SELECT * from PROD.INVOICE")
%>
<TABLE BORDER=1>
<TR>
<!--Create the header rows-->
<% For i = 0 to RS.Fields.Count - 1 %>
<TD><B>
<% =RS(i).Name %>
</B></TD>
<% Next %></TR>
<!--Get all the data and close the connection-->
<%
v=RS.GetRows()
RS.Close
Conn.Close
%><!--Loop through the data and display-->
<% For row = 0 to UBound(v,2) %>
<TR>
<% For col = 0 to UBound(v,1) %>
<TD>
<% = v(col,row) %>
</TD>
<% Next %>
</TR>
<% Next %>
</TABLE>
</BODY>
</HTML>
DISCLAIMER
The information in technical documents comes without any warranty or applicability for a specific purpose. The author(s) or distributor(s) will not accept responsibility for any damage incurred directly or indirectly through use of the information contained in these documents. The instructions may need to be modified to be appropriate for the hardware and software that has been installed and configured within a particular organization. The information in technical documents should be considered only as an example and may include information from various sources, including IBM, Microsoft, and other organizations.