Thread: Problem with VB-DirectODBC selecting text-fields [Virus checked] [EBEWE Viruschecked]

Problem with VB-DirectODBC selecting text-fields [Virus checked] [EBEWE Viruschecked]

From
Wolfgang.Fuertbauer@ebewe.com
Date:
Hi,

i have a problem with the following SQL-Statement:

Select Groessen from Weg where Bsnr = 14957 and Znr = 1 and wegkz = 1;

when executing it via direct-odbc in VB it gives me the error-nr: 3146

the VB-Code:
------------
Set myConn = myWs.OpenConnection("", _
                                 dbDriverNoPrompt, _
                                 False,_
                                 "ODBC;dsn=PostgreSQL;uid=postgres;pwd=;")
sql = "Select Groessen from Weg where Bsnr = 14957 and Znr = 1 and wegkz =
1"
Set rs = myConn.OpenRecordset(Sql, _
                              dbOpenSnapshot, _
                              dbExecDirect, _
                              dbOptimistic)


the database:
-------------
      7.1.3

the ODBC-Version:
-----------------
      7.01.00.09

the table 'weg' in database 'fakt32':
-------------------------------------

fakt32=#\d weg

  Attribute  |         Type          |                    Modifier
-------------+-----------------------+----------------------------
  inr        | integer               | not null default
nextval('"weg_inr_seq"'::text)
  wegnr      | integer               | default 0
  wegkz      | smallint              | default 0
  bsnr       | integer               | default 0
  znr        | integer               | default 0
  arnr       | character varying(15) |
  arname     | character varying(30) |
  arlfnr     | integer               | default 0
  arlfname   | character varying(25) |
  arlfarnr   | character varying(15) |
  datum      | date                  |
  bkz        | integer               | default 0
  groessen   | text                  |
  bestellung | text                  |
Indices: weg_bsnr_key,
          weg_pkey,
          weg_wegnr_key


- excuting the same query via psql works fine:
      fakt32=# Select Groessen from Weg where Bsnr = 14957 and Znr = 1 and
   wegkz = 1;
       groessen
   ---------------
     6;72;0;7;32;0
   (1 row)

- executing the same query via pgadmin II also works fine
- executing the same query via Access (linked table) also works fine
- looking at the logs:

in psqlodbc_4294820759.log beginning from line 170:
--------------------------

>conn=170740516, query='Select Groessen from Weg where Bsnr = 14914 and
>Znr = 1 and wegkz = 1'
>    [ fetched 1 rows ]

that's OK

>conn=170740516, query='SELECT * FROM Select Groessen from Weg where Bsnr
>= 14914 and Znr = 1 and >wegkz = 1'

???? where does this "SELECT * " come from ?

>ERROR from backend during send_query: 'ERROR:  parser: parse error at or
>near "Select"'

this is the result of the 2nd (wrong) query

mylog_4294820759.log shows the same

Please help!

(See attached file: psqlodbc_4294820759.zip)(See attached file:
mylog_4294820759.zip)

mfG

----------------------------------------------------------
Wolfgang Fuertbauer,          wolfgang.fuertbauer@ebewe.com
c/o EBEWE Pharma Ges.m.b.H Nfg.KG   Tel: +43 7665 8123 315
Mondeseestrasse 11                  Fax: +43 7665 8123 11
4866 Unterach, Austria

Attachment