End Google Ads 201810 - BS.net 01 --> Hello,
In my program I need to be checked if the database was deleted, the program creates it again. So, I made a database and connected it to my program with 'LINQ-To-SQL-Classes', when I delete the database manually ("Database1.mdf" and "Database1_log.ldf"), it cannot create the database and show me this error:
" Database 'C:\Users\Saleh\documents\visual studio 2010\Projects\St\St\bin\Debug\Database1.mdf' already exists. Choose a different database name. "

Here is my code:

private void button1_Click(object sender, EventArgs e) { string strDBPath = Application.StartupPath + ("\\Database1.mdf"); DataClasses1DataContext objDB = new DataClasses1DataContext(strDBPath); if (!objDB.DatabaseExists()) { objDB.CreateDatabase(); MessageBox.Show("Database created!"); } }
How can I handle it?

Thanks in advance!