I'm going mad just trying to get the correct result from an Access database through ODBC using C#. I've got the following:
private void dishNameBox_TextChanged(object sender, System.EventArgs e)
textBox1.Text = "";
string sql = "SELECT d_name FROM dishes WHERE d_name LIKE '" + dishNameBox.Text.Trim() + "*'";
OdbcCommand command = new OdbcCommand(sql, conn);
OdbcDataReader reader = command.ExecuteReader();
textBox1.Text += reader.GetString(0);
where conn is a tested OdbcConnection. The problem is that the reader OdbcDataReader doesn't want to return anything even when the query should (I've tested it directly in Access). In fact, when I remove the 'WHERE' part of the SQL, it returns all of the d_names as required.