Cram
Cram

Reputation: 1

C# Remote Connectionstring SQL Server

ich got some problems connecting to the database stored on a server in the local network. I tryed almost everything, but nothing helps. I got 2 Databases, MYSQL and MSSQL.
Configuration:
Server: 192.168.0.198
MYSQL Port: 3306
MSSQL Port: 1433

If i connect manuelly in Visual Studio it works, but if i copy the ConnectionString from the properties, it only connects to the MYSQL Database and not the MSSQL (same login, same password, same ip adress, but ports are different)

In Visual Studio is P3B-Server\P3BMSSQL for the server and db_Software for the database

Visual Studio Properties:
"Data Source=P3B-Server;Initial Catalog=db_Software;User ID=myUser;Password=mypassword"

But it doesnt work :/ I tryed

  1. "Data Source=P3B-Server..."
  2. @"Data Source=P3B-Server\P3BMSSQL..."
  3. "Data Source=192.168.0.198,1433..."
  4. "Data Source=tcp:192.168.0.198,1433..."

Still no connection to MSSQL Server, only MYSQL Server.

I`m connecting with HeidiSQL to both Databases and got
"Microsoft SQL Server (TCP/IP, experimental)" with 192.168.0.198, Port 1433, user=myUser and Password=mypassword" for the MSSQL Server and there it works.

Checked "connectionstrings.com", but no solution works for me.
PS: Other side is an ASP.NET application, which connects with

<connectionStrings>
        <add name="ApplicationServices" connectionString="Data Source=192.168.0.198;Initial Catalog=db_Software;User Id=myUser;Password=myPassword;" providerName="System.Data.SqlClient"/>
</connectionStrings>

(stored in Web.config) to the database. I need exact this for my C# application as a Connectionstring.
Please help me. Thanks !

Upvotes: 0

Views: 834

Answers (1)

Tomer Klein
Tomer Klein

Reputation: 446

<connectionStrings>
        <add name="ApplicationServices" connectionString="Data Source=192.168.0.198\P3BMSSQL;Initial Catalog=db_Software;User Id=myUser;Password=myPassword;" providerName="System.Data.SqlClient"/>
</connectionStrings>

Upvotes: 2

Related Questions