Create .mdf/.sdf database dynamically
How can I with "code" create a new .mdf/.sdf database? I've tried this: http://support.microsoft.com/kb/307283 All it does is fail on the ConnectionString. Since I have no connection to a file that exists before I create it, how can I only connect to the SQL Express Server just to create a mdf/sdf database? I want to be able to just connect to the server and create the file, from there it probably will be easier to create the tables and such. Any suggestions? Ehsan Enaloo public static void CreateSqlDatabase(string filename) { string databaseName = System.IO.Path.GetFileNameWithoutExtension