cooldude87801
asked on
Open .mdf created by SQL Server Management Studio
Hi,
I have created a database under the SQL Server Management Studio, but when I tried to open this database from Visual Studio C# or Visual Web Developer I get a permission error saying
"This file is in use. Enter a new file name or close the file that is open in another program"
I am sure that i closed the SQL Server Management Studio and its instances.
What am I missing here?
Second question, is there a way to work with both applications Visual C# for instance and the SQL Management Studio on the same database? Since the studio offers more DB features
Thank you
I have created a database under the SQL Server Management Studio, but when I tried to open this database from Visual Studio C# or Visual Web Developer I get a permission error saying
"This file is in use. Enter a new file name or close the file that is open in another program"
I am sure that i closed the SQL Server Management Studio and its instances.
What am I missing here?
Second question, is there a way to work with both applications Visual C# for instance and the SQL Management Studio on the same database? Since the studio offers more DB features
Thank you
ASKER
HI nasserd:
First how can i detach it from SQL Server?
Second, as far as I know, there are more funtionalities in SQL Management than in VS that's why I want to us both
Also, is there a way to generate SQL statements from my tables where I can copy and paste.
Thank you
First how can i detach it from SQL Server?
Second, as far as I know, there are more funtionalities in SQL Management than in VS that's why I want to us both
Also, is there a way to generate SQL statements from my tables where I can copy and paste.
Thank you
ASKER
Hi,
I would appreciate any feedback regarding my questions:
1- Can use VS and SQL Management Server together to access one database
2- If not, how I can detach the database from one IDE so I can access through the other one
3- How I can generate SQL statements
Thank you in advance!!
I would appreciate any feedback regarding my questions:
1- Can use VS and SQL Management Server together to access one database
2- If not, how I can detach the database from one IDE so I can access through the other one
3- How I can generate SQL statements
Thank you in advance!!
SSMS (sql server mgmt studio) is only an IDE to the Sql Server engine. That engine, which runs as a Windows Service, locks the database.
To detach a database, you have to go into SSMS, connect to the database server, then right-click the database to expose functions. The right-click is the power of generating sql statements, too (although not complex ones).
For complex sql generators, you'll have to consider commercial software (a Bing or Google search should suffice).
To use 2 IDE's to interact with your database, you would use SSMS as you currently do... but DO NOT DETACH the database. In VS you would connect to the database server engine (local)\SQLEXPRESS or whatever its name, then interact that way.
To detach a database, you have to go into SSMS, connect to the database server, then right-click the database to expose functions. The right-click is the power of generating sql statements, too (although not complex ones).
For complex sql generators, you'll have to consider commercial software (a Bing or Google search should suffice).
To use 2 IDE's to interact with your database, you would use SSMS as you currently do... but DO NOT DETACH the database. In VS you would connect to the database server engine (local)\SQLEXPRESS or whatever its name, then interact that way.
ASKER
Hi nasserd,
I am trying to connect to the DB using VS as you have explained but I am getting an error as shown in the attached file.
DBerror.jpg
I am trying to connect to the DB using VS as you have explained but I am getting an error as shown in the attached file.
DBerror.jpg
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
no one else provide me with an answer for my question
ASKER
no one else provided me with an answer
You would have to detach the file from SQL Server if you want to manage the database separately.
Optimally, you can access some functions through VS when you connect to the database itself (through its existing SQL Server instance).