Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi everybody :)

I am currently building a project to connect a set of offices with their manager office..
i'm using C# and SQL server express edition 2008 (.mdf file).
The server app ((the database)) should be on the manger office ...
The other offices are clients and they'll connect to the server database by lan or wi-fi network and insert,update or even delete records...
my problem is "How the clients can connect with the server database at the same time ?"

is there any suggestion or code may help me ?
I'm very thankful for your help :)
Posted
Updated 15-Jul-13 3:20am
v2

1 solution

Put the IP address of the machine where the Sql Server instance is installed in the connection string when you access the database. Example:

C#
connectionString="Server=XXX.XXX.XXX.XXX\SQLExpress;AttachDbFilename=c:\asd\qwe\mydbfile.mdf;Database=dbname;Integrated Security=True;Connect Timeout=30;User Instance=True;Provider=SQLOLEDB;"


Where XXX.XXX.XXX.XXX is the IP Address
 
Share this answer
 
v4
Comments
obada dawara 15-Jul-13 9:39am    
thanks a lot :)
but In this way, can multiple users connect to the database and make changes at the same time ?
and may it work with sql server express edition normally ?
Johnny J. 15-Jul-13 9:42am    
Yes. You can run into problems if two users attemp to change the same data at the same time. That is the constant worry with multi user databases. You have to deal with it the best way you can, and how to do that is an entirely different and much more complicated issue. You should read up on "database locking".

It should work with Sql server express, but for the best performance, I recommend that you use a "real" Sql server installation.
obada dawara 15-Jul-13 9:47am    
ok, I'm very grateful .. I'll try it :)

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