VBA Recordset.AddNew and NOT NULL fields

Поиск
Список
Период
Сортировка
От Brian Haney
Тема VBA Recordset.AddNew and NOT NULL fields
Дата
Msg-id 001701bf4117$6054d9d0$8101a8c0@specter.fresno.cybernaut.com
обсуждение исходный текст
Список pgsql-interfaces
I have a PostgreSQL (6.5.2) table "vendors" with a serial primary key
"vendor_id".

When I try to add a new record from VBA (under Excel 97, SR-2a) I get
Run-time error 3155ODBC -- insert on linked table '???' failed.

A review of the odbc log file shows that it was trying to execute the
following command:

INSERT INTO  "vendors"
("vendor_id","vendor_name","contact_id","vendor_addr1","vendor_addr2","vendo
r_city","vendor_state","vendor_zip","vendor_country","vendor_email","vendor_
phone","vendor_fax","vendor_promo","vendor_promo_url","vendor_url","vendor_c
omments","last_modified")
VALUES(NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL
,NULL,NULL,NULL)

which of course fails since the primary key, vendor_id, cannot be null.

(The failure message from PostgreSQL was:
"ERROR:  ExecAppend: Fail to add null value in not null attribute
vendor_id".)

I'm using the PostgreSQL ODBC driver 6.40.00.6 from Insight Distribution.

Is it possible to configure the driver or the recordset so it will not
attempt to insert a new record with all NULL values when I invoke the AddNew
method?

Brian Haney



В списке pgsql-interfaces по дате отправления:

Предыдущее
От: Assaf Arkin
Дата:
Сообщение: Transaction support in 6.5.3/JDBC
Следующее
От: Joseph Shraibman
Дата:
Сообщение: sql question