大家好。
首先,我想和大家在一起很高兴。我试图为我的学校项目做点东西,我需要帮助。
我在dreamhost服务器上有我的mysql数据库,我制作了程序来测试我在该数据库上的连接,并且每次收到它无法连接的消息。
这是代码:
然后我发布了我的程序的照片。

请帮助我,谢谢大家。
首先,我想和大家在一起很高兴。我试图为我的学校项目做点东西,我需要帮助。
我在dreamhost服务器上有我的mysql数据库,我制作了程序来测试我在该数据库上的连接,并且每次收到它无法连接的消息。
这是代码:
private void button1_Click(object sender, EventArgs e) { string connetionString = null; SqlConnection connection; SqlCommand command; string sql = null; string serverName = textBox1.Text; string databaseName = textBox2.Text; string userName = textBox3.Text; string Password = textBox4.Text; int num = 1; connetionString = "Data Source=" +serverName+ ";Initial Catalog=" +databaseName+ ";User ID=" +userName+ ";Password=" +Password+ ""; sql = "SELECT * FROM mitAdminLogIn WHERE adminID =" +num+ ""; connection = new SqlConnection(connetionString); try { connection.Open(); command = new SqlCommand(sql, connection); command.ExecuteNonQuery(); command.Dispose(); connection.Close(); MessageBox.Show(" ExecuteNonQuery in SqlCommand executed !!"); } catch (Exception ex) { MessageBox.Show("Can not open connection ! "); } }
然后我发布了我的程序的照片。

请帮助我,谢谢大家。