Use SMO to create a database, rather than crafting your own DDL.
using Microsoft.SqlServer.Management.Common;
using Microsoft.SqlServer.Management.Smo;
Server server = new Server(@"locahost\sqlexpress");
Database db = new Database(server, "YourDatabaseName");
db.Create();
You will also need to add references to the SMO assemblies to your project.
Give that a try.
Sincerely,
Malcolm Sheridan
Microsoft Certified Solution Developer
Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as
Answer" if a marked post does not actually answer your question.
