Link to home
Start Free TrialLog in
Avatar of MDWinter
MDWinter

asked on

Table/View/Synonym not found - Can't query openedge db via ODBC

Hi,

I'm trying to write a console application in VB.net that will query an openedge 10.1b database and return the results (yeah, I could use the Progress tools but I wanna do other stuff with the data independent of the openedge server - this is just a proof of concept)

The connection seems to open ok - but having problems running a query.

I've attached my code - which fails at line 10.

The error returned is:

ERROR[42502][DataDirect][ODBC Progress OpenEdge Wire Protocol driver][OPENEDGE]Table/View/Synonym not found

Presumably there is something wrong with my query? The table removals definitely exists, and definitely contains the fields r-num and r-name - which are both

Any clues?


Imports System.Data.Odbc
 
Module Module1
 
    Sub Main()
 
        Dim DbConnection As New OdbcConnection("DSN=removedforsecurity;Uid=sysprogress;Pwd=")
 
        DbConnection.Open()
 
        Dim DBcmd As New OdbcCommand
 
        DBcmd = DbConnection.CreateCommand
 
        DBcmd.CommandText = "SELECT r-num, r-name FROM removals"
 
        Dim DBReader As OdbcDataReader
        DBReader = DBcmd.ExecuteReader()
 
        Dim strcol1 As String
        Dim strcol2 As String
 
        While DBReader.Read
 
            strcol1 = DBReader.GetString(DBReader.GetOrdinal("r-num"))
            strcol2 = DBReader.GetString(DBReader.GetOrdinal("r-name"))
            Console.WriteLine(strcol1, " - ", strcol2)
 
        End While
 
        DBReader.Close()
        DBcmd.Dispose()
        DbConnection.Close()
 
 
    End Sub
 
End Module

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Chad Smith
Chad Smith
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of MDWinter
MDWinter

ASKER

Knight00 - I actually tried that before you replied and it partially works so I'll give you the points and start a new topic.

As a note for anyone that might come across this in future - to help get the sql query bit right I downloaded ODBCView http://www.sliksoftware.co.nz/products/odbcview/ as you can use it to pass the query to the ODBC driver and see what the result is.

There's also a problem with the hyphen in the field name but I'll put that in a separate post.
I also figured out the rest myself - the field names need to be enclosed in double quotes :)