How to make a dB connection on another PC?

connect local database on my PC everything works, the other does not work although the file path is automatically set
swears it is on the dB connection.

"************ Exception Text **************
System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 52 - Unable to locate a Local Database Runtime installation. Verify that SQL Server Express is properly installed and that the Local Database Runtime feature is enabled.) ---> System.ComponentModel.Win32Exception (0x80004005): the system cannot find the file specified"

string file = @"\Database1.mdf";
 string path = Path.Combine(Environment.CurrentDirectory);
 full_fille string = path + file;
 connect = @"Data Source = (LocalDB)\MSSQLLocalDB; AttachDbFilename="+full_fille+";Integrated Security = True";


the project "https://yadi.sk/d/lORIhaWv0fXRlA"

5e8ff8b648847342021197.jpeg
April 18th 20 at 12:54
1 answer
April 18th 20 at 12:56
Solution
You clearly said that
52 - Unable to locate a Local Database Runtime installation.

Put sqlexpress. And everything will start.
Additionally, configure the connection using the database. Option file it is more for development.
the server can be such as to deliver? or will have to rewrite everything? - Nikko commented on April 18th 20 at 12:59
@Nikko, In General, see the General method is this:

On your SQL server, attach the file that you already have.
Database1.mdf
Database1_log.ldf
If necessary, change the name of the database.

Then in the program change the connection string to the following
Server=myServerAddress;Database=Database1;Trusted_Connection=True;

Actually, it all. Or put sqlexpress and use the old method.

59c3d882da.jpg - Tate5 commented on April 18th 20 at 13:02
@Tate5,
Actually, it all
not a fact. we still have ports open in the firewall. as for the adult server (if not configured yet) and the Express edition. in addition, for servers, it is sufficient to open a single port, and with Express may have to Tinker
(I never had the patience to get to the bottom that would light up the Express server browse )) - rogers_Hin commented on April 18th 20 at 13:05
@rogers_Hin, I have not delved. If Express, then add in the installer and let him put, of course, the choice of a sequel is present. And so the corporate are almost always uzhev the organization and configured.
The maximum that request that DBA gave rights and unrolled backup or defy. - Tate5 commented on April 18th 20 at 13:08
@Tate5, about and understood. by kament to a greater extent, even for TC. since he obviously is able to resolve )) - rogers_Hin commented on April 18th 20 at 13:11
@Nikko, on the topic of firewall, if you have any difficulty, you'll appreciate these links
https://docs.microsoft.com/ru-ru/sql/database-engi...
https://docs.microsoft.com/ru-ru/sql/sql-server/in... - rogers_Hin commented on April 18th 20 at 13:14

Find more questions by tags C#SQL