Solved

Open .mdf created by SQL Server Management Studio

Posted on 2009-06-28
8
883 Views
Last Modified: 2013-11-27
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
0
Comment
Question by:cooldude87801
  • 6
  • 2
8 Comments
 
LVL 4

Expert Comment

by:nasserd
ID: 24732672
An MDF file is a MS SQL Server database file; the file is in use when SQL Server service is running (and locking) the file.

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).
0
 

Author Comment

by:cooldude87801
ID: 24733768
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

0
 

Author Comment

by:cooldude87801
ID: 24739556
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!!
0
 
LVL 4

Expert Comment

by:nasserd
ID: 24741712
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.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:cooldude87801
ID: 24761970
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
0
 

Accepted Solution

by:
cooldude87801 earned 0 total points
ID: 24781336
I am still waiting for an answer please
0
 

Author Comment

by:cooldude87801
ID: 25286517
no one else provide me with an answer for my question
0
 

Author Comment

by:cooldude87801
ID: 25286520
no one else provided me with an answer
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now