VB.Net and Progress 9.1D

FerGo

New Member
Hi to all, I'm the new guy and I'm happy to join this community.

My question is the following:

How do I do to create an ODBC connection between VB.Net and progress 9.1D, I'm using the MERANT 3.60 32-BIT Progress SQL92 v9.1D driver.

I'm new in this, so I don't have any idea how the strings it supposed to be... just I have the driver configured and running (I can import info to an Excel worksheet via this driver).

Thanks in advance for the info.
 

Casper

ProgressTalk.com Moderator
Staff member
KB P65268:
The following sample VB.Net code shows how to retrieve data from a
Progress database using SQL92 and ADO.Net and fill a .Net DataSet with
the results:
' This Variable Will Be Bound To The UI DataGrid Control Using The
' DataSource Property Of The DataGrid Control
Dim SomeDataSet As New DataSet
' Instantiate ODBC Connection Object First As It Is Needed By The
' Command Object And Consequently The Adapter Object
Dim SQLConnection As New
OdbcConnection("DSN=Some_ODBC_DSN;UID=SomeUser;PWD=SomePassword")
' Instantiate ODBC Adapter Which Hold Instances Of Our Command Objects
Dim SQLAdapter As New OdbcDataAdapter
' Instantiate Command Object With Desired SQL Command And What
Connection
' Object It Will Execute Against
SQLAdapter.SelectCommand = New
OdbcCommand("YourSelectCommandGoesHere", SQLConnection)
' All The Prep Work Has Been Completed So Now We Open The Connection
SQLConnection.Open()
' Now We Tell The Adapter To Load The Results Of The Command Object
' Defined As Its "SelectCommand" Property Into The Dataset
SQLAdapter.Fill(SomeDataSet)
' Now We Tell The DataGrid UI Control To Use The Loaded DataSet As
' The Source Object From Which It Will Display Data
SomeDataGridControl.DataSource = SomeDataSet
' Finally, We Close And Dispose Of The Objects The We No Longer Need
SQLAdapter.Dispose()
SQLConnection.Close()
SQLConnection.Dispose()

HTH,

Casper.
 

FerGo

New Member
Thanks for the response, although I receive an error in a line:

Dim SomeDataSet AsNew DataSet
Dim SQLConnection AsNew OdbcConnection("DSN=TESTEMS2ADM;UID=SOMEUSER;PWD=")
Dim SQLAdapter AsNew OdbcDataAdapter
SQLAdapter.SelectCommand =
New OdbcCommand("Select * from saldo-estoq;", SQLConnection)
SQLConnection.Open()
' IN THIS LINE COMES THE ERROR!!!!!!
SQLAdapter.Fill(SomeDataSet)
' THE LINE ABOVE IS THE ERROR!!!!!!!!
DataGridView1.DataSource = SomeDataSet
SQLAdapter.Dispose()
SQLConnection.Close()
SQLConnection.Dispose()

The error is:
ERROR [42S02] [DataDirect-Technologies][ODBC PROGRESS driver][PROGRESS]Table/View/ not found (7519)

Can you say me why happend this?... Thanks in advance.


 

Casper

ProgressTalk.com Moderator
Staff member
Hi There,

You should preceed your tablename with the schema qualifier PUB:

So:
Code:
 select * from PUB."[COLOR=#a31515]saldo-estoq[/COLOR]"

Also use quotes around tables with a dash or sql will interpret it as a minus sign.

Casper.
 
Top