I am using Visual Studio 2010 C # Express and SQL Server Management Studio with SQL Server 2012. I get an error when I try to connect a database to my Windows forms project.
"This file is in use. Enter a new name or close the file that is open in another program"
I poked on the Internet to try to find a solution, but no one worked. So I decided to create a completely new database and a completely new project. But I still get the error!
Here are the steps I'm using:
- First I connected to the local server
- then I right-clicked on
Databases and selected New Database and named it school - then I right-clicked the
tables folder in my new database and selected new table - I added these tables
student, course, enrolled - finally i put some dummy entries in it
Now I turn to VS
- I select
New Project , then Windows Forms Application and name it Registrar - then click
add new data source - select
database in the Choose a data source type window - then I select
Dataset in the Choose a Database Model window - then I click
New Connection I change the DataSource on the Microsoft SQL Server Database File to the DATA folder inside my SQLEXPRESS folder, and when I click on the school.mdf file, I get the above error.
Any help would be greatly appreciated.
source share