0

So this is what I have:

  • Wordpress website hosted on a shared server X with the usual DB for the Wordpress instalation and a second DB with a table containing costumers
  • Asp.net MVC app hosted on server Y that I need to connect to the costumer table to get all the costumers

I have search in SO and I come up with this in for the controller on the MVC app:

SqlConnection conn = new SqlConnection();
            conn.ConnectionString =
                 "Data Source=**ip-address-of-server-x**/costumers" +
                 "User Instance=true;" +
                 "User Id=**user**" +
                 "Password=**pass**" +
                 "AttachDbFilename=|DataDirectory|Database1.mdf;";
            conn.Open();

I'm getting "Server not found". I am not sure I can access the DB this way or maybe the problem is in the format of the Data Source string.

newhouse-pt
  • 141
  • 2
  • 13
  • 3
    If it is a MySql database then why do you use the classes for connecting to Sql Server? – Steve Aug 22 '19 at 14:48
  • @Steve Thanks! You have pointed me in the right direction. I just followed this: https://stackoverflow.com/a/52546882/8211585 – newhouse-pt Aug 22 '19 at 14:58

0 Answers0