Runtime Database Modifications

Hi,

I want to provide database 'backwards compatibility' within my software. I have an application which uses ADO parameterised queries for adding/deleting data.

Now supposing in a future release of the software, the database has some more tables and queries added - I would like to be able to check the database version (by looking at a version field in the database) and then update its structure if it is not the correct format for the current release of software - without losing any of the users data which has may have been put into the database while they were using the previous version of the software.

This means I may need to add new parametrised queries and tables into the database at runtime - any Ideas at how I could achieve this?

My first thought was to provide an empty new style database with each software update and then copy the data from the old one into the new one and then delete the old database and rename the new database to be the old one - bit of a hack but I cant find an alternative way on msdn/forums.

Thanks

CW
[1111 byte] By [waxed] at [2007-11-18 2:14:54]
# 1 Re: Runtime Database Modifications
You should be able to use standard SQL statements such as ALTER TABLE to change an existing database schema.
Tron at 2007-11-10 8:56:30 >
# 2 Re: Runtime Database Modifications
Thanks - and how do you add queries to the database.
waxed at 2007-11-10 8:57:29 >
# 3 Re: Runtime Database Modifications
If by parameterized queries you mean Stored Procedures than you can use standard SQL Statements again, take a look at CREATE PROCEDURE.
Tron at 2007-11-10 8:58:38 >