BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Not including identity column in an insert

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (Multi-Tier)
View previous topic :: View next topic  
Author Message
Brandon Lilly
Guest





PostPosted: Thu Jul 03, 2003 7:26 pm    Post subject: Not including identity column in an insert Reply with quote



I have an ADODataSet with a select statement for a table that includes
an IDENTITY column (TAutoInc).

I changed the field to a TIntegerField, turned off the ReadOnly
property and set the provider flag to [pfInKey]

On the client side I am inserting a new record, populating the
identity column with -1, -2, etc as necessary to distinguish the
records on the client. WHen I applyupdates, I get an error that I
cannot explicitly set and identity column value. I profiled the query
and it is indeed, using the identity column in the insert statement,
which it should not be doing.

I am doing this exact same thing in countless other datasets in our
project and I can't seem to find anything different between them. Why
is Delphi insisting on including the identity column in the insert
statement? How can I force this not to happen?

Brandon
--
"In the beginning the universe was created. This has made a lot of
people very angry, and has been widely regarded as a bad move." -
Douglas Noel Adams (1952-2001)


Back to top
Ignacio Vazquez
Guest





PostPosted: Thu Jul 03, 2003 7:35 pm    Post subject: Re: Not including identity column in an insert Reply with quote



"Brandon Lilly" <brandon.lilly (AT) nospam_medevolve (DOT) com> wrote

Quote:
I changed the field to a TIntegerField, turned off the ReadOnly
property and set the provider flag to [pfInKey]

What about .ReadOnly?

Cheers,
Ignacio



Back to top
Brandon Lilly
Guest





PostPosted: Thu Jul 03, 2003 8:06 pm    Post subject: Re: Not including identity column in an insert Reply with quote



"Ignacio Vazquez" <ivazquezATorioncommunications.com> wrote

Quote:
What about .ReadOnly?

Ahhh, thanks. For some reason the code I was using as a template had
the read-only property of the field set to FALSE, so I assumed it was
necessary.

Many thanks,

Brandon
--
"In the beginning the universe was created. This has made a lot of
people very angry, and has been widely regarded as a bad move." -
Douglas Noel Adams (1952-2001)



Back to top
Brandon Lilly
Guest





PostPosted: Thu Jul 03, 2003 8:12 pm    Post subject: Re: Not including identity column in an insert Reply with quote

Now I am confused. Setting the identity field's ReadOnly property to
True did get rid of it in the insert, but the code I use to populate
the identity column on the server so that it can propogate back to the
client doesn't work because the field is read-only. This explains why
the other identity columns in other datasets are not read-only, but
still doesn't explain why they work, and this one doesn't..

Help!

Brandon
--
"In the beginning the universe was created. This has made a lot of
people very angry, and has been widely regarded as a bad move." -
Douglas Noel Adams (1952-2001)


Back to top
Ignacio Vazquez
Guest





PostPosted: Thu Jul 03, 2003 8:19 pm    Post subject: Re: Not including identity column in an insert Reply with quote

"Brandon Lilly" <brandon.lilly (AT) nospam_medevolve (DOT) com> wrote

Quote:
Now I am confused. Setting the identity field's ReadOnly property to
True did get rid of it in the insert, but the code I use to populate
the identity column on the server so that it can propogate back to the
client doesn't work because the field is read-only. This explains why
the other identity columns in other datasets are not read-only, but
still doesn't explain why they work, and this one doesn't..

Try setting the server column to read-only, and the client column to
read-write.

Cheers,
Ignacio



Back to top
Brandon Lilly
Guest





PostPosted: Thu Jul 03, 2003 8:20 pm    Post subject: Re: Not including identity column in an insert Reply with quote

Here's some more mystery. It works now. All I did, was turn the
column back to not be ReadOnly..... There must have been something
messed up in Delphi that was causing a property of the
field/dataset/provider not to get set correctly.

It works now, however.

Cheers,

Brandon
--
"In the beginning the universe was created. This has made a lot of
people very angry, and has been widely regarded as a bad move." -
Douglas Noel Adams (1952-2001)


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (Multi-Tier) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.