Reputation: 33
I have built a window form application and I use ADO.NET entity Data model to make connection with my local database and it work good with my own PC (the database and application in one PC).
Now I need the application to be used by many users 3 or 4. I have no idea how to install my database on the server and whether ADO.NET entity Data model will work again. I use SQL Server 2008 and C# window Form. Please I am waiting to hear what your suggestion will be.
Upvotes: 1
Views: 1182
Reputation: 1148
You have host your database on server
Get server ip,username,password for the database
change your connection string
replace server name ,username,password
Data Source=serverip;Initial Catalog=dbname;Persist Security Info=True;User ID=username;Password=password
then this will be goto server database
Upvotes: 0
Reputation: 2082
Add app.config file to your project and specify the connection string in there. Then access the config file using c#
<connectionStrings>
<add name="MyDBConnectionString" providerName="System.Data.SqlClient"
connectionString="Data Source=localhost;Initial Catalog=MySQLServerDB; Integrated Security=true" />
</connectionStrings>
in c#
System.Configuration.ConfigurationManager.ConnectionStrings["MyDBConnectionString"].ConnectionString;
Source Accessing database connection string using app.config in C# winform
Upvotes: 0
Reputation: 26209
all you need to do is just change the Data Source
value in your connection string.
Follow the below Steps:
Step 1: Install and Maintain Your Database
in your server machine.
Step 2 : Specify your databse Server HostName/IP Address
in your Connection String as below:
String connectionString="Data Source=ServerName;Intial Catalog=DatabaseName;UID=userID;Password=password;Integrated Security=True;"
Upvotes: 2