The following code is available:
string Connect = "server=localhost;uid=admin;password=admin;persistsecurityinfo=True;database=test_database"; string CommandText = "SELECT Count(*) FROM login WHERE login = '" + textBox1.Text + "' AND password = '" + textBox2.Text + "' LIMIT 1"; MySqlConnection myConnection = new MySqlConnection(Connect); MySqlCommand myCommand = new MySqlCommand(CommandText, myConnection); myConnection.Open();**//я не понял что тут писать?** myCommand.ExecuteNonQuery();**//и тут тоже?** MySqlDataAdapter dataAdapter = new MySqlDataAdapter(myCommand); DataTable dt = new DataTable(); dataAdapter.Fill(dt); if (dt.Rows[0][0].ToString() == "1") { this.Hide(); disp dp = new disp(); dp.Show(); } else { MessageBox.Show("Пожалуйста, проверьте правильность введенных данных!"); } Error on line: myCommand.ExecuteNonQuery() :
MySql.Data.MySqlClient.MySqlException: "Unknown column 'password' in 'where clause'"
How to fix it?
Openmethod; it simply opens the connection. And theExecuteNonQuerymethod executes anSQLfor the established connection and returns the number of rows involved in the instruction. It's not entirely clear what your question is. - Denis Bubnov