Click here to Skip to main content
15,887,821 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have develop one simple school application to main student record... I have use sql server database (LocalDB)\v11.0
I want to run this application same time on three or four computer... through networking.... it possible... or it will give error because all are using same database on same time... please clarify.....
Posted
Updated 19-Sep-19 18:11pm

If you are using SQL Server, then that is exactly what it is designed for: multiple users.
The only thing you may have to change is the connection string, depending on how you coded it.
 
Share this answer
 
Comments
Member 10279246 25-Jan-14 8:18am    
can you show any example... for multiple user connection string
OriginalGriff 25-Jan-14 9:25am    
No, it isn't that the string has to be different for each user (though it might, if you want different access rights) It's that the string has to be a PC reference (rather than LOCALHOST or similar) followed by the SQL Server instance name. If you have hard coded a string, then it's likely to give you problems, so you may need to change your code to allow for a settings-file based string.
Member 10279246 26-Jan-14 1:26am    
This is my string... can you please tell what changes are needed in this:
connectionString="Data Source=(LocalDB)\v11.0;Initial Catalog=DeeJayDataBaseAdams;Integrated Security=True"
Hello,
To Answer your question if the machines are connected internally through LAN it is possible.
Just host the application in one machine through IIS Refer this How To Deploy a Web App in IIS
Copy the path..distribute to other machines and check the Intranet accessibility.

For Sql server connection :

Pls provide access to other users to the database and check the accessibility from other machines .

eg:)
SQL
- Create user windows Authentication
CREATE LOGIN [YourDomainName] FROM WINDOWS
WITH DEFAULT_DATABASE = [YourDatabase];
GO
-- Add User to first database
USE YourDatabaseHere;
CREATE USER X FOR LOGIN [YourDomainNameJohnJacobs];
EXEC sp_addrolemember 'db_datareader', 'X'
EXEC sp_addrolemember 'db_datawriter', 'X'
Go

-- Create user for SQL Authentication
CREATE LOGIN X WITH PASSWORD = 'X'
,DEFAULT_DATABASE = [YourDatabase]
GO
-- Add User to first database
USE YourDatabaseHere;
CREATE USER X FOR LOGIN X;
EXEC sp_addrolemember 'db_datareader', 'X'
EXEC sp_addrolemember 'db_datawriter', 'X'
GO


For your query for connectionstring:In the Web.config pls code like this

HTML
<connectionStrings>
	
    <add  name="yourconnectionstring"  connectionString="Data Source=yourserverName\SQLEXPRESS;Initial Catalog=yourDatabaseName;Integrated Security=True"  providerName="System.Data.SqlClient" />
  </connectionStrings>


Wala!Your work is complete!

Pls write back if you need more support:)
 
Share this answer
 
v2
Comments
Member 10279246 26-Jan-14 1:28am    
My Application in vb.net.... and I am using sql server which is default installed by Visual studio 2012.... Which connection string I am using that is;
connectionString="Data Source=(LocalDB)\v11.0;Initial Catalog=DeeJayDataBaseAdams;Integrated Security=True"
Please help
karthik Udhayakumar 26-Jan-14 1:42am    
Have updated the solution ..pls check above on how to connect using the connection string!
Member 10279246 27-Jan-14 3:06am    
I will try.. and contact you...
Member 14598452 20-Sep-19 1:18am    
I also have the same problem, I want to try your code but I don't know where to code the database authentication? please help thanks

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