Re: Problem with VB-DirectODBC selecting text-fields [EBEWE: Virus - Mailing list pgsql-odbc

From Wolfgang.Fuertbauer@ebewe.com
Subject Re: Problem with VB-DirectODBC selecting text-fields [EBEWE: Virus
Date
Msg-id OF6520574B.15BC2D06-ONC1256B76.002EE9FF@ebewe.co.at
Whole thread Raw
List pgsql-odbc
Hi Corey,

On 08.03.2002 04:29:52 "Corey W. Gibbs" wrote:
>Wie geht es Ihinen (hope i got that right, it's been 15 years since i've
>taken German :))

:) Yes you got that right or: Danke, es geht mir gut. with a little
headache because the below described trouble ;-)

>Howdy Wolfgang,
>Try enclosing criteria in single quotes '
>so Select Groessen from Weg where Bsnr='15947' etc...

don't know if I got that right; I'm enclosing the query-criteria; see:

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

I think, that the problem is, that field "groessen" is defined as fieldtype
text;
I created a separte table where field groessen is defined as varchar(65535)
(I'm porting an MS-Access-Application and in Access this field is a
memo-type)
and it works perfect;

? do I have to configure the ODBC-Driver: no check on "Text as longvarchar"
???

best regards
Wolfgang

>
>> 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)
>>
>Should get you going.  In order to pass variables, you'd need to use the &
>in VB so the above select line would be:
>dim foo as string
>dim bar as integer
>
>sql = "Select Groessen from Weg where Bsnr = '" & foo & "' and Znr = & '
>"bar & " ' and wegkz => & '"bar  & "'"
>
>notice the single quotes in the above? hope this helps.
>
>corey
>
>----- Original Message -----
>From: <Wolfgang.Fuertbauer@ebewe.com>
>To: <pgsql-odbc@postgresql.org>
>Sent: Tuesday, March 05, 2002 12:10 AM
>Subject: [ODBC] Problem with VB-DirectODBC selecting text-fields [EBEWE:
>Virus checked]
>
>
>>
>>
>> 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 beginning from line 94853
>>
>> 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
>>
>
>
>
----------------------------------------------------------------------------

>----
>
>
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>>


pgsql-odbc by date:

Previous
From: Alan Wayne
Date:
Subject: Please Help! Trying to connect Foxpro 6.0 to RH postgresql via ODBC
Next
From: Alan Wayne
Date:
Subject: ODBC