How to create a database from a deployment project?

  • Thread starter Thread starter Manu
  • Start date Start date
M

Manu

I would like to create a database for my application when it is
deployed.
This database can be from different types depending on the tool
installed on the customer computer and will be chosen during the
startup wizard.
Where do I write the code in the project?
How do I open a new database programmatically?
How do I open a new database and copy data to it from my files
programmatically?
Is there an example explaining this?
 
Manu,

You should use the ADOX library through COM interop. ADO.NET doesn't
have a mechanism that supports the altering of the schema of a database.
Right now, you have to use ADOX.

Hope this helps.
 
If I understand you correctly, you want your app to create a new database
when it is installed. There is no simple way to do it, but depending on
which DBMS you're using (SQL Server, Access, Oracle, etc) there may be tools
to help generate some of the code. You will want to do this when the program
is run for the first time. The code will most likely involve a lot of SQL
statements such as CREATE DATABASE, CREATE TABLE, etc. There may be examples
out there, but you're best bet is to search Google.
 
Back
Top