Feedback
Did this article resolve your question/issue?

   

Article

VB.NET sample code to connect a Progress Database

« Go Back

Information

 
TitleVB.NET sample code to connect a Progress Database
URL NameP160513
Article Number000130616
EnvironmentProduct: Progress
Version: 9.1x
Product: OpenEdge
Version: 10.1x, 11.x
OS: Windows
Other: ODBC, VB.NET
Question/Problem Description
VB.NET sample code to connect a Progress Database

SQL: Sample VB.NET code to establish a DSN-Less ( DSNless ) ODBC connection to an OpenEdge database.

How to connect a VB .NET client to an OpenEdge database without defining a DSN?

 
Steps to Reproduce
Clarifying Information
Error Message
Defect Number
Enhancement Number
Cause
Resolution
The following VB .NET code sample demonstrates how to establish a DSN less ( DSN-Less ) connection to an OpenEdge database:
Imports System
Imports System.Data
Imports System.Data.Odbc

Module Module1

    Sub Main()
        Dim myConnectionString As String = "DRIVER={Progress OpenEdge 11.7 Driver};HOST=localhost;PORT=9999;DB=sports2000;UID=pub;PWD=pub;DIL=0"
        Dim mySelectQuery As String = "SELECT Custnum, Name, City FROM PUB.Customer WHERE CustNum < 3"
        Dim myConnection As New OdbcConnection(myConnectionString)
        Dim myCommand As New OdbcCommand(mySelectQuery, myConnection)

        myConnection.Open()

        Console.WriteLine(myConnection.State.ToString)
        Console.WriteLine(myConnection.ConnectionString)

        Dim myReader As OdbcDataReader = myCommand.ExecuteReader()
        Try
            While myReader.Read()
                Console.WriteLine(myReader.GetString(0) + "  " + myReader.GetString(1) + "  " + myReader.GetString(2))
            End While
        Finally
            myReader.Close()
            myReader = Nothing
            myCommand = Nothing
            myConnection.Close()
            myConnection = Nothing
        End Try

    End Sub

End Module
Workaround
Notes
Last Modified Date11/20/2020 7:08 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.