Я использую Visual Studio 2010, и когда я связываю DataGridView с моей удаленной базой данных mysql, он отлично работает .
но когда я беру строку подключения из мастера и пытаюсь использовать ее с кодом, я получаю: "поставщик: поставщик именованных каналов, ошибка: 40 - не удалось открыть подключение к SQL Server"
это строка подключения, которую я пробую (я пробовал много вариантов):
"Server = myserver.org; Database = my_db; Uid = MyUser; PWD = mypwd;"
есть идеи?
спасибо
вот код:
string connectionString = "Server = sql.server.org; Database = my_db; Uid = my_user; Pwd = mypwd;";
SqlConnection myConnection = new SqlConnection(connectionString);
SqlDataAdapter mySqlDataAdapter = new SqlDataAdapter("Select * from Table", myConnection);
DataSet myDataSet = new DataSet();
DataRow myDataRow;
// Create command builder. This line automatically generates the update commands for you, so you don't
// have to provide or create your own.
SqlCommandBuilder mySqlCommandBuilder = new SqlCommandBuilder(mySqlDataAdapter);
// Set the MissingSchemaAction property to AddWithKey because Fill will not cause primary
// key & unique key information to be retrieved unless AddWithKey is specified.
mySqlDataAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
mySqlDataAdapter.Fill(myDataSet, "Table");