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][O DBC Progress OpenEdge Wire Protocol driver][OPENEDGE]Table/Vie w/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?
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][O
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I also figured out the rest myself - the field names need to be enclosed in double quotes :)
ASKER
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.