Problem accessing progress database through VB.NET

Posted by Admin on 28-Jan-2007 23:36

Hi,

What do I want?

To access the progress database through VB.NET.

what environments do I use?

Windows XP, progress 10.1A, Microsoft Visual Basic 2005 Express Edition.

What have I done so far?

I have successfully created an ODBC connection and I can easily access progress database (e.g. sports2000) using MS Access 2007 (beta) via ODBC connection.

What is the problem then?

I am trying to create an application using VB.NET that displays the records from the table(database sports2000) through progress 10.1A ODBC driver. Following is the code:

/******************************************************************/

Try

Dim oODBCConnection As OdbcConnection

Dim sConnString As String = "DSN=sports2000;HOST=localhost;PORT=1080;DB=sports2000;UID=manoj;PWD="

oODBCConnection = New Odbc.OdbcConnection(sConnString)

oODBCConnection.Open()

Dim sqlStatement As String = "select * from Customer"

Dim myComm As OdbcCommand = New OdbcCommand(sqlStatement, oODBCConnection)

'Dim reader As OdbcDataReader = Nothing

Dim dsCommand As New OdbcDataAdapter()

dsCommand.SelectCommand = myComm

Dim dsProject As New DataTable()

dsCommand.Fill(dsProject) // this is the statement that generates an error.

oODBCConnection.Close()

Catch ee As System.Data.Odbc.OdbcException

MsgBox("Error1: " & ee.Message.ToString())

Catch eee As System.Exception

MsgBox("Error2: " & eee.Message.ToString())

End Try

/******************************************************************/

when I execute this program I get the message box with the following error.

"Error1: ERROR-20005".

HOW DO I SOLVE THIS PROBLEM?

THANKS A LOT IN ADVANCE.

With Regards,

Manoj Shakya

shakyamanoj@gmail.com

Message was edited by:

Manoj Shakya

Message was edited by:

Manoj Shakya

All Replies

Posted by Admin on 27-Feb-2007 04:23

Hi I had exactly the same problem. I overcame this by changing my sql statment. In your case try changing it to be

select * from PUB.Customer

Version 10 has some strange quirks. Previously I had used an OPENLINK driver and the statement worked without the PUB. against the table name. If I try this on OPENLINK, it fails to recognise the table name.

Basically any existing coding will need to be changed to include the table owner as the prefix.

Hope this helps

Steve Green (Project Delivery Manager)

Posted by Thomas Mercer-Hursh on 27-Feb-2007 10:33

There are a couple other differences which you may encounter, so you might as well be prepared for them. One is that you will need to use double quotes around any field or table name that contains 'illegal' characters such as dash. I.e. Field."Field-name". In my own work I just started quoting all field and table names. The other is that earlier SQL versions used to "explode" an array into multiple fields. Now you will use PROELEMENT(). Look in the manual for examples.

Posted by Admin on 27-Feb-2007 12:35

Hi I had exactly the same problem. I overcame this by

changing my sql statment. In your case try changing

it to be

select * from PUB.Customer

Version 10 has some strange quirks. Previously I had

used an OPENLINK driver and the statement worked

without the PUB. against the table name.

You can set the "pub"-prefix in the registry, see KB-entry P27031:

"...

Add the "DefaultSchema" string value set to "PUB" in the registry:

HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\

..."

Or start your session with the SQL-command:

SET SCHEMA 'PUB';

Posted by Admin on 22-Jan-2009 12:19

I'm having a similar problem but I'm trying to use the ODBC Linked Tables resource of Access 2007. I tried with the quotes, without the quotes, with the PUB. and without the PUB.. All combinations and nothing the table won't open! Where are those examples you mention?

This thread is closed