-1

Example there are three PC's

PC1, PC2 and PC3

There is Server PC1 and that have only SQL Server Express Installed.

Can anyone give me the connection string and settings to connect PC1 from PC2 and PC3?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
parth
  • 91
  • 1
  • 10

1 Answers1

0

On PC1, you must ensure that the SQL Server Express instance allows remote connections (see this other SO question and its answers for details on how to do this.

Also, you need to create logins on the server instance, and users in your database(s). If all those three PC's are members in a Windows network, you can probably create logins based on Windows user accounts - otherwise, you have to use SQL Server specific logins.

Then, on PC2 and PC3, you can use something like this:

server=PC1;database=YourDatabase;User ID=SomeUserID;Password=SomePassword

See ConnectionStirngs.com for a great many more examples and explanations

Update:

If I understand correctly, this is what you want to do:

  • have PC1 be the "server" in your setup - if so, then install SQL Server Express with tools (including the Management Studio) on this server. Make a note of what instance name you use when installing SQL Server Express! The default is SQLEXPRESS, but you can choose anything you like

  • make sure the SQL Server Express instance allows remote connections

  • create the necessary logins on that server instance

  • create your database on that server (where it belongs - after all, SQL Server is a server-based solution)

  • create the necessary users in that database for your logins

With this setup, you should easily be able to connect from PC2 and PC3 to your SQL Server database on PC1

Community
  • 1
  • 1
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • ID=SomeUserID;Password=SomePassword is the computer username and Password or Sql User paswd? – parth Dec 05 '15 at 09:05
  • @parth: those are the credentials for the **SQL Server** instance you're connecting to – marc_s Dec 05 '15 at 09:11
  • SqlConnection Connection = new SqlConnection(@"server=PC1;database=YourDatabase;User ID=PC1UserId;Password=PC1Password") Is it like that..? – parth Dec 05 '15 at 09:16
  • it not work Server name is Pc name or Sql Instance Nameof that Pc or What? – parth Dec 05 '15 at 09:19
  • @parth: the default instance name of a SQL Server Express is `SQLEXPRESS` - so try `server=pc1\SQLEXPRESS` in your connection string. But that's just the default - maybe you or whoever installed this SQL Server Express changed it .... then you need to use the appropriate instance name – marc_s Dec 05 '15 at 09:20
  • It's not work then also i have to place database in specific place or wherever it place they automatically detect. – parth Dec 05 '15 at 09:26
  • @parth: the database just has to be **attached** to the server - not referenced as a "free-floating" `.mdf` file .... – marc_s Dec 05 '15 at 09:28
  • But i dont want to buy Management Studio that's whay i am doing with SqlExpress after installing the management Studion on PC1 then its wok that i know. – parth Dec 05 '15 at 09:30
  • hope you Understand I only want SqlExpress on Server and Connect From all Pcs to Server (PC1) Where the Databse is actually. – parth Dec 05 '15 at 09:33
  • @parth: Management Studio is a ***FREE*** download for SQL Server Express..... you don't need to **buy** anything .... – marc_s Dec 05 '15 at 09:45
  • 1
    Ok then i am Using SQLEXPRWT_x86_ENU (Sql Express with Tools ) that is Free I think..thanks. – parth Dec 05 '15 at 09:55
  • https://www.microsoft.com/en-us/download/details.aspx?id=22973 It's Free? – parth Dec 05 '15 at 10:01
  • @parth: ***Y-E-S*** SQL Server **Express** (all versions of it) is entitrely, totally, utterly ***F-R-E-E*** - even for commercial use – marc_s Dec 05 '15 at 12:08
  • thanks a lot..for your support.. – parth Dec 05 '15 at 12:34