www.Inmagic.com    Inmagic Forums    Inmagic Forums  Hop To Forum Categories  ODBC    SQL query syntax problem
Go
New
Find
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Posted
I have (I believe) installed correctly the ODBC driver for Content Server. I appear to be able to open a connection to the ODBC driver. What I can't do yet is get the database to respond to a query.

I am using ASP, and here is some example code:
dim sql

sql = "select * from ID"

dim result
set result = Server.CreateObject("ADODB.Recordset")

result.Open sql, odbcConn,0,1,2

do while not result.EOF
  response.write result
  result.MoveNext
loop

result.Close
odbcConn.close


I'm pretty sure from reading the INI file that I have a column called "ID". I have tried a range of queries, but they all result in the following error:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Inmagic, Inc.][CS ODBC Driver]Expected lexical element not found: <identifier>

This occurs on the line with result.Open

Can anyone shed any light on what I'm doing wrong? Thanks.
 
Posts: 2 | Registered: Thu June 01 2006Reply With QuoteEdit or Delete MessageReport This Post
Posted Hide Post
In SELECT * from ID, ID is the table name (the textbase name), not the column name (the field name). If you want to get all the IDs in the CATALOG textbase, you would do:

SELECT ID FROM CATALOG

If you want to get the contents of all the fields in all the records in the CATALOG textbase, you would do:

SELECT * FROM CATALOG

Another typical search would be:

SELECT ID, TITLE FROM CATALOG WHERE TITLE = 'Massachusetts*'
 
Posts: 217 | Registered: Wed June 29 2005Reply With QuoteEdit or Delete MessageReport This Post
Posted Hide Post
Thank you for your quick response. I had already tried other queries in the formats you suggested, and they are good suggestions. I've tried everything I can think of, and I keep getting the same error:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Inmagic, Inc.][CS ODBC Driver]Expected lexical element not found: <identifier>

What I am now wondering is how I can do information gathering via ODBC link. I tried using a general query - "show databases" (also show tables, show columns in, etc.) in hopes of getting something to start from, but so far this type of query gives me errors too. It is a different error though, which is something:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Inmagic, Inc.][CS ODBC Driver][Content Server]Unable to open table

I'm just not sure what to try next.
 
Posts: 2 | Registered: Thu June 01 2006Reply With QuoteEdit or Delete MessageReport This Post
 Previous Topic | Next Topic powered by eve community  
 

www.Inmagic.com    Inmagic Forums    Inmagic Forums  Hop To Forum Categories  ODBC    SQL query syntax problem