Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Connection failures

Author  Topic 

Pignon
Starting Member

2 Posts

Posted - 2010-04-15 : 04:56:59
Hello,

I presently learning C# through an online training. To practice what I have seen I have been trying to access databases with Visual Studio 2008 Express. I also have the SQL epress 2008. I'm totally newbie with SQL express (version with management studio).

The scenario is like this:
1) Login to SQL server with Windows authentication.
2) Attach the sample database Northwind
3) Create a new database named LineCtrl with 3 tables (one main having one-to-one relation ship with the 2 others)
All this was done with SQL server management studio.

4) In visual studio C# starting a new Form application.
5) Create a connection to the database LineCtrl, when testing getting the error message:
Unable to open the physical file C\...\LineCtrl.mdf. Operating system error 32 "32(The process cannot access the file because it being used by another process)"
An attempt to attach an autonamde database for file C\...\LineCtrl.mdf failed. A database with the same name exists, or specified file cannot be openend or is located in UNC share.

6) Creating a connection to northwind database works sucessfully but then is unaccessible in SQL express configuration manager (error right clicking for database.properties: An exception occured while executing Transact-SQL statement or batch (Microsoft.sqlserver.connectionInfo).
After this cannot be accessed again from VS studio 2008

So it looks I do something wrong regarding the connection. Can somebody give some sequence to create a database and make it available in VS2008 on a stable way ?

Many thanks for the attention.
BR
Marc
   

- Advertisement -