Creating a database on the fly

  • Thread starter Thread starter Adrian
  • Start date Start date
A

Adrian

I have an application using SqlServer2005 Express
(The user will have installed SqlServer2005 Express,
and have entered the name under which the database
has been installed as a parameter.) How can I code
the required database being created in his
SqlServer2005 express, allowing him to use the
application?

Thanks,
Adrian
 
Assuming I understand your question, there are a several options here. While I don't have the bandwidth to discuss them in detail but:

1) You can add a SQL Server database (item) to the Visual Studio 2005 project. You can then use VS to populate the schema and write code to populate the base data. This can be deployed along with the application--VS does that too.
2) You can write a command batch to attach an existing .MDF database to the customer's SQLEXPRESS instance. This can be integrated into your application's setup script.
3) Your application code can simply connect to the SQLEXPRESS instance and execute a script that includes "CREATE DATABASE..." and create the database, schema etc. in TSQL.

hth


--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Back
Top