Board index » delphi » Insert and Identity columns...

Insert and Identity columns...

All:

I have SQL Server 7 tables that use identity columns. These columns are not
visible to user input. When I insert and then post, I get an "attempting to
update a non-nullable column with a null value." error. The identity column
is the only non-nullable column. I am using D5, ADO 2.5, and SQL Server 7,
SP1. If I try to manually insert a row with Query Analyzer, of course it
works fine.

BTW, I am using TTables.

It seems that this must be a problem with the TTable component or ADO.

Any help appreciated.

Mike

 

Re:Insert and Identity columns...


Use a TAdoTable and set the TField's AutoGenerateValue := arAutoInc for your
identity field.

--
Michael Rodriguez
Compeat Restaurant Accounting Systems
http://www.compeat.com
m...@compeat.com

"Michael J. Austin" <maus...@hevanet.com> wrote in message
news:3b184ed3$1_1@dnews...

Quote
> All:

> I have SQL Server 7 tables that use identity columns. These columns are
not
> visible to user input. When I insert and then post, I get an "attempting
to
> update a non-nullable column with a null value." error. The identity
column
> is the only non-nullable column. I am using D5, ADO 2.5, and SQL Server 7,
> SP1. If I try to manually insert a row with Query Analyzer, of course it
> works fine.

> BTW, I am using TTables.

> It seems that this must be a problem with the TTable component or ADO.

> Any help appreciated.

> Mike

Re:Insert and Identity columns...


Quote
> Use a TAdoTable and set the TField's AutoGenerateValue := arAutoInc for your
> identity field.

This is a good idea as it is but it will not solve the problem. Also set the
Required property of the identity field to False.

HTH
--
Vassil Nazarov
IT Manager, Sofia Cable SA

Re:Insert and Identity columns...


Thanks to both of you. I will give it a try.

Mike

Quote
"Vassil Nazarov" <vas...@mail.orbitel.bg> wrote in message

news:3b1bcd2c_2@dnews...
Quote
> > Use a TAdoTable and set the TField's AutoGenerateValue := arAutoInc for
your
> > identity field.

> This is a good idea as it is but it will not solve the problem. Also set
the
> Required property of the identity field to False.

> HTH
> --
> Vassil Nazarov
> IT Manager, Sofia Cable SA

Other Threads