Hi guys.
Here is what I want to do:
1. create a small desktop application
2. when this application starts, it will check if the file "...mydb.mdf" file exists in a specified folder
3. if the file doesn't exist, I want to create the database and connect to it using User Instance
How can I create the database?
I tried to connect to SQLExpress and run a script using SqlCommand. It didn't work.
Is there any other way to do this?
Or what is the correct way to do it?
Thanks.
Mircea
You can create entire databases in SQL Script using CREATE DATABASE, CREATE TABLE, and other similar commands. Some of them (like CREATE VIEW) must be sent by themselves, but otherwise its pretty simple.
Alternatively, you can embed an empty database in your application and extract it out as needed.
-Ryan / Kardax
|||Hi Ryan.
I have the script for creating the database. My question is how should I run this script?
Thanks.
No comments:
Post a Comment