I just re-read my post and realized that it did not contain the connection code. That is in a seperate asp page. That is below.
<%
' This sample will dynamically generate a table for the QCUSTCDT file on the AS/400 and
' display all the records of the file. The method of retrieving the records is based on the
' user selection in browse.htm. For those records in which the CDTDUE field is
' greater than 0, the CDTDUE value is highlighted in red. If you removed the CDTDUE checking
' code you could use this ASP to generate a table for any AS/400 DB file.
'
' Global.ASA file contains the following information:
' - Library
' - File Name
' - Userid
' - Password
' - AS/400 System Name
' - ODBC data source name
'Always DIM your variables, even though you don't have to.
'All ASP variables are variants, you cannot specify the data type
Dim AS400Connection
Dim AS400Command
Dim AS400File_rs
Dim ConnectionString
Dim Color
Dim ColorEnd
Dim CommandText
Dim CommandType
On Error Resume Next
'dxd
Dim SesVals
SesVals = "Session ID: " & Session.SessionID & "<br>"
SesVals = SesVals & "System: " & Trim(Session("AS400_SystemName"

) & "<br>"
SesVals = SesVals & "User profile: " & Trim(Session("AS400_Userid"

) & "<br>"
SesVals = SesVals & "Password: xxxxxx" & "<br>" '& Trim(Session("AS400_Password"

) & "<br>"
SesVals = SesVals & "Library: " & Trim(Session("Library"

) & "<br>"
SesVals = SesVals & "file: " & Trim(Session("FileName"

) & "<br>"
SesVals = SesVals & "ODBC DSN:" & Trim(Session("ODBC_DataSourceName"

) & "<br>"
response.write SesVals
'Setup appropriate connection string and command information
Select Case Request.Form("ConnectionType"

Case "IBMSQL"
ConnectionString = "Provider=IBMDA400;Data Source=" & Session("AS400_SystemName"

& ";"
CommandText = "SELECT * FROM " & Session("Library"

& "." & Session("FileName"

CommandType = adCmdText
Case "IBMRLA"
ConnectionString = "Provider=IBMDA400;Data Source=" & Session("AS400_SystemName"

& ";"
CommandText = "/QSYS.LIB/" & Session("Library"

& ".LIB/" & Session("FileName"

& ".FILE()"
CommandType = adCmdTable
Case "ODBC"
ConnectionString = "Provider=MSDASQL;DSN=" & Session("ODBC_DataSourceName"

& ";"
CommandText = "SELECT * FROM " & Session("Library"

& "." & Session("FileName"

CommandType = adCmdText
response.write connectionstring 'dxd
Case Else
'No connection type was selected, so redisplay the selection page
Response.Redirect("browse.htm"
End Select
'Open the connection
Set AS400Connection = Server.CreateObject("ADODB.Connection"

AS400Connection.Open ConnectionString,Session("As400_Userid"

,Session("AS400_Password"
Set AS400Command = Server.CreateObject("ADODB.Command"

AS400Command.ActiveConnection = AS400Connection
'Specify Read-Only. See the OLE/DB documentation in the Client Access/400 toolkit for more
'info on the Updatability property. This is a custom property only for the IBMDA400 property.
If (InStr(1,Request.Form("ConnectionType"

,"IBM",vbTextCompare) > 0) Then
AS400Command.Properties("Updatability"

= 0
End If
'Set the command to execute
AS400Command.CommandText = CommandText
AS400Command.CommandType = CommandType
'Execute the command on the AS/400
Set AS400File_rs = AS400Command.Execute
If (Err.Number = 0 ) Then
Response.Write("<table border=1 cellpadding=1 cellspacing=0>"
Response.Write("<tr bgcolor=#c8d8f8>"
' Loop through all the fields in the file and generate the column headings of the table
For Each fd in AS400File_rs.Fields
Response.Write("<td nowrap>" & fd.Name & "</td>"

Next
Response.Write("</tr>"
' Loop through all the records
While NOT AS400File_rs.EOF
Response.Write("<tr>"
'Loop through each field and generate the row the row in the table, if it's the
'CDTDUE field, check to see if it's greater than 0, if so, make it red
For Each field in AS400File_rs.Fields
Color = ""
ColorEnd = ""
If (field.Name = "CDTDUE"

Then
If (CDBL(field.Value) > 0) Then
Color = "<font color=#ff0020>"
ColorEnd = "</font>"
End IF
End If
Response.Write("<td nowrap>" & color & field.Value & ColorEnd & "</td>"
Next
Response.Write("</tr>"

AS400File_rs.MoveNext
Wend
Response.Write("</table>"
Else
'An Error Occurred
DisplayError AS400Connection, Err.Number, Err.Description, Err.Source, "Main"
End If
AS400File_rs.Close
Set AS400File_rs = Nothing
AS400Connection.Close
Set AS400Conection = Nothing
Set AS400Command = Nothing
'**************************************************************************************
'***
'*** Subroutine DisplayError
'***
'**************************************************************************************
Sub DisplayError(Connection,errNum,errDesc,errSource,proc)
On Error Resume Next
Response.Write("<br>VB Error Number: <b>" & errNum & " [0x" & Hex(errNum) & "]</b>"

Response.Write("<br>Err.Description: <b>" & errDesc & "</b>"

Response.Write("<br>Err.Source: <b>" & errSource & "</b>"

Response.Write("<br>Procedure: <b>" & proc & "</b>"
Response.Write("<br>Connection errors: <b>" & Connection.Errors.Count & "</b>"

If (Connection.Errors.Count > 0) Then
For Each ErrorMsg in Connection.Errors
Response.Write("<br>" & ErrorMsg.Description)
Next
End If
End Sub
%>