pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
weird vb6 odbc null problem
2+ messages / 2 participants
[nested] [flat]

* weird vb6 odbc null problem
@ 2007-12-14 17:33  lshafranovich@baisyaakov.net
  0 siblings, 1 reply; 2+ messages in thread

From: lshafranovich@baisyaakov.net @ 2007-12-14 17:33 UTC (permalink / raw)
  To: pgsql-odbc

Hi, I'm a newbie to Postgres and ADO/ODBC programming.  I have a weird problem.  I have a table called scoredata which every time I update (from VB6 via ODBC driver 08.02.0200 Postgres version 8.2.5) a specific smallint field to null, it gets filled in with a 2, 4, or 6.
Here is the applicable code (I simplified it a little to make it shorter):


dim bysCN As New ADODB.Connection
dim scoredataRecordset as ADODB.Recordset

     bysCN.ConnectionString = "DRIVER={PostgreSQL 
unicode};Server=servername;Port=5432;Database=mslocal;Uid=dbadmin;Pwd=password;"
     bysCN.Mode = adModeReadWrite
     bysCN.Open


     Set scoredataRecordset = New ADODB.Recordset
     scoredataRecordset.CursorLocation = adUseClient
     scoredataRecordset.Open "select * from scoredata where "+Chr(34)+"class id"+Chr(34)+" = 6271", bysCN, 
adOpenKeyset, adLockOptimistic
     ...
     scoredataRecordset.Fields("average")=Null
     scoredataRecordset.Update

At this point if I query the database it the "average" field is filled in with a 2,4, or 6.  This problem only seems to happen if the field was not null before but then was changed to null.

This is my table:

 class id          | bigint                      | not null
 stud id           | integer                     | not null
 average           | smallint                    |
 othergrade        | character varying(5)        |
 override          | character varying(5)        |
 deportment        | character varying(5)        |
 numericcomments   | character varying(25)       |
 datecreated       | timestamp without time zone | default now()
 usercreated       | character varying(5)        |
 userupdated       | character varying(5)        |
 othergrade_reason | character varying(2048)     |
 deportment_reason | character varying(2048)     |
 id                | integer                     | not null default nextval('scoredata_id_seq'::regclass)
 thelevel          | smallint                    | default 0
 comment           | character varying(2048)     |
Indexes:
    "scoredata_pkey" PRIMARY KEY, btree (id)
    "scoredata_stud_id_class_id" UNIQUE, btree ("class id", "stud id")
    "scoredata_class_id" btree ("class id")
    "scoredata_stud_id" btree ("stud id")
Foreign-key constraints:
    "scoredata_class id_fkey" FOREIGN KEY ("class id") REFERENCES classes("class id")
    "scoredata_deportment_fkey" FOREIGN KEY (deportment) REFERENCES deportment(deportment)
    "scoredata_othergrade_fkey" FOREIGN KEY (othergrade) REFERENCES other_grades(other_grades)

Thank you so much for your help.  I apologize if I posted or formatted this incorrectly.

L. Shafranovich

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: weird vb6 odbc null problem
@ 2007-12-17 06:57  Hiroshi Inoue <inoue@tpf.co.jp>
  parent: lshafranovich@baisyaakov.net
  0 siblings, 0 replies; 2+ messages in thread

From: Hiroshi Inoue @ 2007-12-17 06:57 UTC (permalink / raw)
  To: lshafranovich@baisyaakov.net; +Cc: pgsql-odbc

lshafranovich@baisyaakov.net wrote:
> Hi, I'm a newbie to Postgres and ADO/ODBC programming.  I have a weird problem.
 > I have a table called scoredata which every time I update (from VB6 
via ODBC driver 08.02.0200 Postgres version 8.2.5)
 > a specific smallint field to null, it gets filled in with a 2, 4, or 6.

Please try the more recent version (the latest version is 8.2.0500) of
drivers.

regards,
Hiroshi Inoue




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2007-12-17 06:57 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-12-14 17:33 weird vb6 odbc null problem lshafranovich@baisyaakov.net
2007-12-17 06:57 ` Hiroshi Inoue <inoue@tpf.co.jp>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox