Thanks Dominic. I have it working - hurray!
Unfortunately I can't add a new PK to the dup table as it has to be an
exact match to the 'live' table, but it is something I might consider
if I run into the problem again.
What I am doing now is saving the record as a new record with a new
PersonID then I create another record object and load it using the new
PersonID. I then setPersonID() with the original PersonID from the
dup_ table.
Thanks for all your help with this. The Monday deadline now seems a
lot less stressful. Plus the fact the client sent through the latest
version of their access db but only sent the front-end and not the
back-end which has all the data!!
Have a good weekend.
Cheers,
Dave
On 25 Apr 2008, at 21:27, Dominic Watson wrote:
This may seem odd, but give your dupe table a new 'surrogate'
primary key that is auto-incrementing - i.e. 'dupePersonId'. The
regular personId should then no longer be the primary key but should
have a unique index/constraint on it as well as a Foreign key
constraint with the original Person table.
Dominic
On 25/04/2008, David Phipps <[EMAIL PROTECTED]> wrote:
Thanks Dominic and Chris I think that must be the cause of the
problem. The downside of this is that I really need the insert to
use that PersonID otherwise my dup_ tables which mirror the main
tables will be out of sync.
I suppose I could do the insert and then overwrite the PersonID with
the PersonID I need. I'll give it a go.
Cheers,
Dave
On 25 Apr 2008, at 20:49, Chris Blackwell wrote:
Yes dominic has the right answer, i'll just elaborate slightly..
your manual query INSERTS a new record into the DB. However your
reactor code is trying to UPDATE a record with PersonId 4972. I
don't think that you can create a record with reactor in the manor
you are attempting. If you remove the setPersonId() call you will
see a new record created with the next Id in your table, but you
cannot force the id of a newly inserted record using reactor.
i hope that makes sense,
Chris
On 25/04/2008, Dominic Watson <[EMAIL PROTECTED]> wrote:
If PersonId is the primary key of the tblpeople table, reactor will
perform an update query in this instance (as the primary key is
already set). So the SQL being executed through the save method
would look something like:
UPDATE tblpeople (PersonID,Title)
SET Title = 'Mrs'
WHERE PersonId = 4972
HTH
Dominic
On 25/04/2008, Chris Blackwell <[EMAIL PROTECTED]>
wrote:
Sorry, if this has been mentioned, i haven't read the whole thread...
Does tblpeople have a primary key? Show me the create table
statement
Chris
On 25/04/2008, David Phipps <[EMAIL PROTECTED]>
wrote:
OK, I really am struggling. I cannot for the life of me get any
data to insert into the tblpeople table in the db.
I am able to run the following query directly on the db:
<cfquery name="setPerson" datasource="#dsn#">
INSERT INTO tblpeople (PersonID,Title)
VALUES(4972,'Mrs')
</cfquery>
When it is done through reactor via:
persRecord = createRecord('tblpeople')
persRecord.setPersonID(4972)
persRecord.setTitle('Mrs')
persRecord.save()
The values are placed into the persRecord object and can be dumped
out but the actual save() does nothing.
Can anyone point me in the right direction. My reactor config is
below (from previous email). I want to say it is a problem with one
of the relationships and I think I will set up a really cut down
version of my reactor config file to see if that is true, but
otherwise I am at a loss. I have never had Reactor do this before -
It must be something I have done wrong but I cannot see what??
More help would be really appreciated, the client wants it ready
for Monday and I don't have time to start restructuring too much.
Cheers,
Dave
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- --
Reactor for ColdFusion Mailing List
[EMAIL PROTECTED]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- --
--
Blog it up: http://fusion.dominicwatson.co.uk
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- --
Reactor for ColdFusion Mailing List
[EMAIL PROTECTED]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- --
Reactor for ColdFusion Mailing List
[EMAIL PROTECTED]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- --
_______________________________________________________________________
David Phipps
Director, Chapel Studios
T +44 (0)20 7100 6980 F +44 (0)20 7100 6981 M +44 (0)7765 240899
New Broad Street House, 35 New Broad Street, London, EC2M 1NH, UK
http://www.chapel-studios.co.uk
_______________________________________________________________________
The Chapel Studios group of companies are registered in England.
'Chapel Studios' and the Chapel Studios logo are registered
trademarks of Chapel Studios. The information in this email is
confidential, intended solely for the addressee, and may be legally
privileged. If you are not the addressee or authorized to receive
this for the addressee, you must not use, copy, disclose or take any
action based upon this message or any information herein. If you
have received this message in error, please advise the sender
immediately by reply e-mail.
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- --
Reactor for ColdFusion Mailing List
[EMAIL PROTECTED]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- --
--
Blog it up: http://fusion.dominicwatson.co.uk
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- --
Reactor for ColdFusion Mailing List
[EMAIL PROTECTED]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- --
_______________________________________________________________________
David Phipps
Director, Chapel Studios
T +44 (0)20 7100 6980 F +44 (0)20 7100 6981 M +44 (0)7765 240899
New Broad Street House, 35 New Broad Street, London, EC2M 1NH, UK
http://www.chapel-studios.co.uk
_______________________________________________________________________
The Chapel Studios group of companies are registered in England.
'Chapel Studios' and the Chapel Studios logo are registered trademarks
of Chapel Studios. The information in this email is confidential,
intended solely for the addressee, and may be legally privileged. If
you are not the addressee or authorized to receive this for the
addressee, you must not use, copy, disclose or take any action based
upon this message or any information herein. If you have received
this message in error, please advise the sender immediately by reply e-
mail.
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Reactor for ColdFusion Mailing List
[EMAIL PROTECTED]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --