Shamal Sabah
Shamal Sabah

Reputation: 239

C# windows application set up on different machines and all work on one SQL Server 2008 database

I have created a desktop application with SQL Server 2008 as backend. I want to use this database from my application that is installed on a number of machines.

What are the requirements for that application to connect to the centralized database.?

Upvotes: 0

Views: 1833

Answers (2)

AgentFire
AgentFire

Reputation: 9790

To keep the connection string in its resources, ofcourse.

Resources are:

  1. Doubleclick on project's Properties (at solution explorer).
  2. Then Settings tab.
  3. If there is no default setting file, create it by clicking the long link label.
  4. Add a setting like "ConnectionString" with the value like "Data Source = ..." whatever.

Then you can run your sql scripts like:

SqlConnection conn =
    new SqlConnection(Properties.Settings.Default.ConnectionString);

And go on.

Upvotes: 0

gout
gout

Reputation: 812

It is pretty simple, You want the architecture as Client-Server model were the server has the database .Hence you need to have MS SQLserver 2005 or higher versions and create database connect it to sqlserver. Grant permission for the clients to access the database.

From visual studio side: Add the above created .mdf(database file) as the new data source. Data-->Add new Data Source , and follow the steps in the wizard[p.s the type of connection has to be sql sever type ] while doing this a connection string will be created by VS. Use tht connection string to access from the client side.

This link would be useful : http://msdn.microsoft.com/en-us/library/sxds9ett(v=vs.80).aspx

Upvotes: 1

Related Questions