question

Walter Ochynski avatar image
Walter Ochynski asked

Connect to SQL Server Express from Excel and ASP.NET

I finally connected to SQL Server Express 2008 from Excel. The excel macro can write and read data in the sql database. However if I connected from excel I cannot connect from ASP.Net. When my website is running and I try to connect from excel I get the error message: "The process cannot access the file because is being used by another process" When I was working with access database I could connect from asp.net and office application without any problems. What can I do to be able to connect simultaneously from two applications to the same sql database? Thanks for your help. Walter

sql-server-2008excel
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Walter Ochynski avatar image
Walter Ochynski answered

In the end I found answer myself. I have changed the connection string from: add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\DatabaseT.mdf;Database=dbname;Integrated Security=True;Asynchronous Processing=True;User Instance=True" providerName="System.Data.SqlClient" to add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;Integrated Security=SSPI;Initial Catalog=|DataDirectory|\DatabaseT.mdf;Database=dbname;" providerName="System.Data.SqlClient" and now I can work simultaneously in Excel and ASP.net but why it works now I do not have a clue.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.