TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
shilpa sonawane
NA
8
14.2k
To write dynamic connection string(c#2008,SQL SERVER 2005)
Mar 7 2012 8:23 AM
I have used Attach a database file, located in the data directory, on connect to a local SQL Server Express instance.code is
conn = new SqlConnection();
conn.ConnectionString = "Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\carRent.mdf;Integrated Security=True;User Instance=True";
return conn;
But I get error :
Unable to open the physical file "D:\CarRent Completed\CarRent\bin\Debug\carRent.mdf". Operating system error 32: "32(The process cannot access the file because it is being used by another process.)".
An attempt to attach an auto-named database for file D:\CarRent Completed\CarRent\bin\Debug\carRent.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
how to solve this error?Thanks for your time and consideration.
Reply
Answers (
1
)
Keys in C#
How to display files in a multiple directory?