Click here to Skip to main content
15,897,891 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,
My application needs to run on a sharing network. Different connections from different computers hit database at the same time. SSCE 3.5 gives File sharing violation error.

I added .mdf file and tried the application but it did not run on second computer.
Do I need to setup SQL Server Express in a certain way?

Thanks
Posted

1 solution

A single instance of SQL server can use a MDF file only.

Just connect to the IP address or computer name of your SQL server for the other machines instead of attaching a MDF file for each.


EDIT:
Assuming computernameoftheserver is name of the hosting database and dbname is your database name :
C#
SqlConnection con = new SqlConnection("data source=computernameoftheserver;integrated security=sspi; initial catalog=dbname;");
con.Open();
SqlDataAdapter sda = new SqlDataAdapter("select * from tablename", con);
Dataset ds;
sda.Fill(ds);
 
Share this answer
 
v2
Comments
Furqan Sehgal 10-Jan-12 4:53am    
Can you give little example, I make connections using dataset
Mehdi Gholam 10-Jan-12 5:00am    
I have updated the answer.
Furqan Sehgal 10-Jan-12 8:51am    
Thanks ! but I use typed datasets so I just change the dataset connection string?
Mehdi Gholam 10-Jan-12 9:03am    
Yes, exactly.
Furqan Sehgal 10-Jan-12 9:05am    
Is there any way to use SSCE database on sharing basis? Forums say no but I have found Microsoft documentation, they say yes. Upto 256 connections at a time.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900