Error with ODBC connection from VB .NET 2.0

235 views
Skip to first unread message

r.kope...@exchangeit24.com

unread,
Apr 10, 2008, 10:42:13 AM4/10/08
to intersystems.public.cache, sup...@intersystems.com
A customer of ours is having an error when using our ODBC
functionality to connect to a Caché database.

Our application is written in Visual Basic .NET 2.0 and uses the
built- in ODBC data provider. The connection is made via a system DSN.
The SQL it sends is as simple as:

SELECT * FROM "PatientInformation"

The error returned is:

ERROR [42000] [Caché ODBC][State : 37000][Native Code 1] [C:\Program
Files\CardExchange\CardExchange.exe]
[SQLCODE: <-1>:<Invalid SQL statement>] [Cache Error:
<<SYNTAX>errdone+1^%qaqqt>]
[Details: <Prepare>]
[%msg: < SQL ERROR #1: `ID' expected, `:' found^SELECT * FROM :%qpar>]

Please, any suggestions about what's going wrong. Is the use of quotes
allowed? I have to use quotes to be able to support an arbitrary
database.

Thanks,
Rutger.

htg

unread,
Apr 11, 2008, 6:53:33 PM4/11/08
to intersystems...@info2.kinich.com
r.kope...@exchangeit24.com schrieb:

> A customer of ours is having an error when using our ODBC
> functionality to connect to a Caché database.
>
> Our application is written in Visual Basic .NET 2.0 and uses the
> built- in ODBC data provider. The connection is made via a system DSN.
> The SQL it sends is as simple as:
> SELECT * FROM "PatientInformation"

It seems that your ODBC data provider interprets "PatientInf" as avariable
string. That's not allowed syntax.


> The error returned is:
>
> ERROR [42000] [Caché ODBC][State : 37000][Native Code 1] [C:\Program
> Files\CardExchange\CardExchange.exe]
> [SQLCODE: <-1>:<Invalid SQL statement>] [Cache Error:
> <<SYNTAX>errdone+1^%qaqqt>]
> [Details: <Prepare>]
> [%msg: < SQL ERROR #1: `ID' expected, `:' found^SELECT * FROM :%qpar>]
>

Your query is understood as SELECT * FROM ?

> Please, any suggestions about what's going wrong. Is the use of quotes
> allowed? I have to use quotes to be able to support an arbitrary
> database.

maybe VB.NET uses different syntax to singnal arbritrary tables


Jay Ayliff

unread,
Apr 13, 2008, 7:25:38 AM4/13/08
to intersystems...@info2.kinich.com
Hi Rutger,

Double-quoted strings can be treated as strings or as SQL entities depending
on a SQL setting in Cache: In SQL Settings->Support Delimited Identifiers.
The settings are:
Yes: A double-quoted string is considered a delimited identifier (what you
want in this case)
No: A double-quoted string is treated as a literal string (allows literal
strings "like this" or 'like that'

HTH

Jay Ayliff

<r.kope...@exchangeit24.com> wrote in message
news:035a7f9b-b298-460b...@q1g2000prf.googlegroups.com...

Anil Agarwal

unread,
Apr 14, 2008, 8:29:30 PM4/14/08
to intersystems...@googlegroups.com
Write the table name without double quotes.
simply send the following sql statement:
SELECT * FROM PatientInformation
--
Thanks & Regards
Anil Kumar Agrawal
+91-9982610778
+91-141-2340757
Reply all
Reply to author
Forward
0 new messages