 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Vadim Guest
|
Posted: Thu Apr 26, 2007 5:16 am Post subject: inserting record using ttable with identity field: sql serve |
|
|
Hi,
I am wondering if there are gurus out there who coulld explain the following
behavior:
When I have to insert a new record into an sql server table with identity
field like
ID Integer IDENTITY PRIMARY KEY,
...... other fields
I do that in the following sequence:
1. myTable.Insert
2.do something
!!!!3. make ID field required := False//because ID is autopopulated by sql
server
4. issue myTable.Post
This works almost everywhere but some people do report that in some
instances this would give them
an error :Can not insert value NULL into column ID....
Could there be any difference in the ODBC or sql server settings?
I know that I shouldn't be using TTables and I am planning to upgrade to
D2007 with new db libraries, but it will take time to convert trillion lines
of code,
so need some advice on that.
Thank you
Vadim |
|
| Back to top |
|
 |
Dmitry Arefiev Guest
|
Posted: Thu Apr 26, 2007 8:11 am Post subject: Re: inserting record using ttable with identity field: sql s |
|
|
Hello Vadim
| Quote: | !!!!3. make ID field required := False//because ID is autopopulated
by sql server
|
1) I will suggest to set Required = False, at design time, if you
are using persistent fields, or right after table is open.
2) Are you sure your code does not explicitly assign Null value
to ID column ?
Regards,
Dmitry
--
Dmitry Arefiev - www.da-soft.com
AnyDAC - Oracle, MySQL, MSSQL, MSAccess, IBM DB2, Sybase
ASA, DbExpress, ODBC freeware data access framework
ThinDAC - mtier data access engine |
|
| Back to top |
|
 |
Roland Guest
|
Posted: Mon May 07, 2007 5:32 am Post subject: Re: inserting record using ttable with identity field: sql s |
|
|
Check database, make sure the column is identity field. That identity field
might changed to integer in some unknown cases.
Roland
"Vadim" <vadim (AT) dontsend (DOT) com> wrote in message
news:462fe102$1 (AT) newsgroups (DOT) borland.com...
| Quote: | Hi,
I am wondering if there are gurus out there who coulld explain the
following behavior:
When I have to insert a new record into an sql server table with identity
field like
ID Integer IDENTITY PRIMARY KEY,
..... other fields
I do that in the following sequence:
1. myTable.Insert
2.do something
!!!!3. make ID field required := False//because ID is autopopulated by sql
server
4. issue myTable.Post
This works almost everywhere but some people do report that in some
instances this would give them
an error :Can not insert value NULL into column ID....
Could there be any difference in the ODBC or sql server settings?
I know that I shouldn't be using TTables and I am planning to upgrade to
D2007 with new db libraries, but it will take time to convert trillion
lines of code,
so need some advice on that.
Thank you
Vadim
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|