" tag is used to define a row within a table. After that, a FOR/NEXT loop is used to output the field names for each row in our recordset object. These values are used as column headings within our table.

Then, we read through each record within our recordset and output the field values in the appropriate column. When all records have been read (that is, the value of rs.EOF is TRUE), the rs.Close and conn.Close statements are executed to free up the ADO resources used by the page.

When loaded into the C:Inetpubwwwroot folder on your PC, this page will appear as shown in Figure 6.

http://www.mcpressonline.com/articles/images/2002/aspV4--11070503.jpg
Figure 6: The output from our ASP is shown in a Web browser.

This page displays a list of all files in the library QSYS on the iSeries defined on the connection object. This data is retrieved from the SYSTABLES file in QSYS2 library on that iSeries.

Again, this is a simple example, but it gives you an idea of the power and ease-of-use of ASP. In just over 30 lines of ASP code, we've created an application in no time flat that can read and display data from your iSeries.

Only the Beginning

In this article, we've just scratched the surface of how powerful Active Server Pages are. It's amazing how easily you can create Web-enabled applications that use your iSeries database. I once created a complete application in a half a day using ASP that would've taken me a week of programming time in RPG.

For more details and examples of creating ASP applications that access the iSeries, check out my book Active Server Pages Primer. This book will help get you on the road to ASP ASAP.

Mike Faust is an application programmer for Fidelity Integrated Financial Solutions in Maitland, Florida. Mike is also the author of the books The iSeries and AS/400 Programmer's Guide to Cool Things, and Active Server Pages Primer, and SQL Built-in Functions and Stored Procedures. You can contact Mike at mikeffaust@yahoo.com.

Figure 5: This ASP generates a Web page using iSeries data.

This page begins by defining our ADO connection object. This object allows us to define the type of database we are connecting to as well as additional parameters specific to that connection. In our case, we are using the Client Access ODBC driver. It's important to recognize that the value for the SYSTEM parameter shown here would have to be changed to reflect the IP address or system name for your iSeries, and the UID and PWD values would have to reflect a valid user ID and password for your iSeries.

Next, we create an ADO recordset object. This object is the means through which we can retrieve data from the database defined on the connection object. The rs.open statement defines the data to be retrieved using an SQL SELECT statement.

Now, we use the Response.Write method to send output to the client browser. This statement can be used to send simple text or HTML tags, which the browser will then interpret. The "


Mike Faust
About the Author:

Mike Faust is the Manager, Systems Development for BrightHouse Networks in Maitland, Florida. Mike is also the author of the books The iSeries and AS/400 Programmer's Guide to Cool Things, Active Server Pages Primer, SQL Built-in Functions and Stored Procedures, and JavaScript for the Business Developer. You can contact Mike at mikeffaust@yahoo.com.

 

MC Press books written by Mike Faust available now on the MC Press Bookstore.

 

JavaScript for the Business Developer JavaScript for the Business Developer

Learn how JavaScript can help you create dynamic business applications with Web browser interfaces.

List Price $44.95
Now On Sale
 
Active Server Pages Primer Active Server Pages Primer
This book takes an in-depth look at the ASP concept and how to make the most of it.

List Price $79.00
Now On Sale
 
SQL Built-In Functions and Stored Procedures

SQL Built-In Functions and Stored Procedures


This book provides a terrific introduction to the creation and use of SQL built-in functions and stored procedures under OS/400 and i5/OS.

List Price $49.95
Now On Sale
 
Read More >>
Last Updated on Sunday, 06 November 2005 18:00
 

You must be logged in to view or make comments on this article.


User Rating: / 0
PoorBest 

Related Articles:

WHITE PAPERS

The following White Papers can be found at the MC White Paper Center

 

 


   MC-STORE.COM