Connecting to MySQL server via C# -


This is my code, which means connecting to a MySQL server and getting some information:

 Using the  system; Using System.Collections.Generic; Using System.Text; Using System.Data.SqlClient; Namespace test_MLDropCopy {class program {static zero main (string [] args) {string connection string = "server = xxxxx; uid = xxxxx; pwd = xxxxx"; SqlConnection mySqlConnection = New SqlConnection (connectionString); Select the symbol from string selection string = "today_positions.all_rttp 'where the service name like' ml% 'and id = 137800; sqlCommand mySqlCommand = mySqlConnection.CreateCommand (); mySqlConnection.Open (); MySqlCommand.CommandText = selectString; SqlDataReader myReader = MyReader = mySqlCommand.ExecuteReader (); String symbol = myReader ["symbol"]. ToString (); Console.WriteLine (symbol); mySqlConnection.Close ();}}}  

However, it seems to me that the error is:

  Unchecked exception: System.Data.SqlClient.SqlException: When setting up a connection to a network or connection to SQL Server Stance-specific error occurred: The server was not found or was not accessible. Verify that the name of the instance is C and SQL Server is configured to allow remote connection. (Provider: Named Pipes Provider, Error: 40 - Can not open connection to SQL Server)  

I am using login credentials whether there is a problem in my code, or problem with the database end (offline, upper Enough permission etc)?

SqlConnection class is not the base class for the DB connection; Its aim is to connect MS SQL Server DBS to a basic OleDbConnection or OdbcConnection; If your MySQL example supports it, then I will use ODDI.


Comments