Feedback
Did this article resolve your question/issue?

   

Article

Sample ASP Program to access Progress Database via SQL-92 Engine

« Go Back

Information

 
TitleSample ASP Program to access Progress Database via SQL-92 Engine
URL Name20158
Article Number000173340
EnvironmentProgress 9.1x
Question/Problem Description
How to access Progress SQL-92 via a sample Microsoft Active Server Pages program.
How to access a Progress database via ASP?
Sample ASP pages to access Progress database via SQL-92
Steps to Reproduce
Clarifying Information
Error Message
Defect Number
Enhancement Number
Cause
Resolution
The connection is done via ODBC. It uses a System data source name (DSN). User name and password should be specified to in the connection.

The program assumes that there is a sports2000 database running on your local system using port 2500 which is specified in the DSN. Also, the example uses user "dba1" with a password of "password" entered at the connection string.
The following code uses the ASP statement On Error Resume in order to handle ODBC error and warning messages at the program level. The On Error statement can be used to avoid the display of the following ODBC warning messages:

- [MERANT][ODBC PROGRESS driver]Optional feature not implemented.

- [MERANT][ODBC PROGRESS driver]Driver's.
The program provides a variable called mydebug and the procedure
DisplayODBCErrors to display the errors if the variable is set to true.


The program:
 

<hmtl>
<title>Sample ASP Page Using Progress SQL-92 database</title>
<body>

Time: <%=now%><br>

<%
On Error Resume Next
Dim mydebug
   mydebug = false

' DSN defined as db=sports2000;host=localhost;port=2500

myDSN = "dsn=p91a;uid=dba1;pwd=password"
mySQL = "select custnum, creditlimit from pub.""customer"""

set conntemp = server.createobject("adodb.connection")
conntemp.open myDSN

response.write "Err.Number = "
response.write (Err.Number)
response.write " Conntemp.Errors.Count = "
response.write (conntemp.Errors.Count)

DisplayODBCErrors()
%>

<br>

<table border="2">
<%
set rstemp = conntemp.execute(mySQL)

DisplayODBCErrors()

if rstemp.eof then
  response.write "No record matched<br>"
  conntemp.close
  set conntemp = nothing
  response.end
end if

do until rstemp.eof %>
  <tr><td> <%=rstemp(0) %> </td><td><%=rstemp(1) %> </td><td>
<%=rstemp(2) %> </td></tr>
<%
  rstemp.movenext
loop
%>

</table>

<%
rstemp.close
set rstemp = nothing

Response.end

conntemp.close
set conntemp = nothing
%>

<% Function DisplayODBCErrors() %>
<br>
<% if mydebug and (conntemp.Errors.Count > 0) then %>
<br><br><b>ODBC Connection Error and Warning Messages</b><br>
<% For intLoop = 0 To conntemp.Errors.Count - 1 %>

Error No: <%= conntemp.Errors(intLoop).Number %><BR>
Description: <%= conntemp.Errors(intLoop).Description %><BR>
Source: <%= conntemp.Errors(intLoop).Source %><BR>
SQLState: <%= conntemp.Errors(intLoop).SQLState %><BR>
NativeError: <%= conntemp.Errors(intLoop).NativeError %><P>

<% Next %>
<% end if %>
<% End Function %>

</body>
</html>

References to Written Documentation:

Progress SQL-92 Guide and Reference

Progress ODBC Driver Guide
Workaround
Notes
NOTE: The Progress WebSpeed product can be used to web-enable applications or to develop web applications accessing Progress databases or Progress DataServer databases.

The Progress approach is scalable, portable, connects natively, and allows deployment of compiled code among other features.
Last Modified Date9/14/2015 6:53 AM
Attachment 
Files
Disclaimer The origins of the information on this site may be internal or external to Progress Software Corporation (“Progress”). Progress Software Corporation makes all reasonable efforts to verify this information. However, the information provided is for your information only. Progress Software Corporation makes no explicit or implied claims to the validity of this information.

Any sample code provided on this site is not supported under any Progress support program or service. The sample code is provided on an "AS IS" basis. Progress makes no warranties, express or implied, and disclaims all implied warranties including, without limitation, the implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample code is borne by the user. In no event shall Progress, its employees, or anyone else involved in the creation, production, or delivery of the code be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample code, even if Progress has been advised of the possibility of such damages.