T
TheNortonZ
In my application I have a reasonably complex dataset. I would like to
implement Save As functionality within the application.
When a user first opens the application, they either open an existing
dataset (based on a combo selection) or they do new and a new dataset is
created (by creating default records in the database and returning them to
the app).
There are two methods of Save As that I would like to implement:
1. Save the currently open dataset to a newly named dataset.
2. Save the currently open dataset to a currently named dataset.
So...
Save the currently open dataset to a newly named dataset...my ideas here
would be to create a new project with a new primary key ID and let the
system create this new dataset as it normally would, then copy the current
dataset, not including its primary key ID into the new dataset. Then save
this dataset. This would create a problem though because a lot of the tables
have autoincrement/identity keys.
I will still keep the original dataset as a project, so basically, I will
have the original plus a brand new project.
Saving the current dataset is no problem, but I'm not sure to do about
copying the dataset. Should I first do a clone and then loop through all the
rows copying them?
I have read some hints on this newsgroup that sound similar to what I am
doing but I got lost somewhere in between setting the identity keys to -1
and AcceptChangesDuringFill.
2. Save the currently open dataset to a currently named dataset...At first,
I thought this would be more simple, but then it appears that its not. The
dataset that is currently open already has all of its unique IDs, and the
dataset (project name) listed in the dropdown list of course already has its
IDs. Now, I think I would have to take the new master primary key, and loop
through each table and do updates. Not sure about this though.
Are there any suggested design patterns for doing things like this?
STom
implement Save As functionality within the application.
When a user first opens the application, they either open an existing
dataset (based on a combo selection) or they do new and a new dataset is
created (by creating default records in the database and returning them to
the app).
There are two methods of Save As that I would like to implement:
1. Save the currently open dataset to a newly named dataset.
2. Save the currently open dataset to a currently named dataset.
So...
Save the currently open dataset to a newly named dataset...my ideas here
would be to create a new project with a new primary key ID and let the
system create this new dataset as it normally would, then copy the current
dataset, not including its primary key ID into the new dataset. Then save
this dataset. This would create a problem though because a lot of the tables
have autoincrement/identity keys.
I will still keep the original dataset as a project, so basically, I will
have the original plus a brand new project.
Saving the current dataset is no problem, but I'm not sure to do about
copying the dataset. Should I first do a clone and then loop through all the
rows copying them?
I have read some hints on this newsgroup that sound similar to what I am
doing but I got lost somewhere in between setting the identity keys to -1
and AcceptChangesDuringFill.
2. Save the currently open dataset to a currently named dataset...At first,
I thought this would be more simple, but then it appears that its not. The
dataset that is currently open already has all of its unique IDs, and the
dataset (project name) listed in the dropdown list of course already has its
IDs. Now, I think I would have to take the new master primary key, and loop
through each table and do updates. Not sure about this though.
Are there any suggested design patterns for doing things like this?
STom