I have a somewhat amateurish problem here.
I can not do this SELECT
from 2 CONDITIONS, and I can not find the ERROR! Someone please give me a light there!
Follow the Code:
OleDbConnection Con = new OleDbConnection();
Con.ConnectionString = Properties.Settings.Default.dbConnection;
Con.Open();
OleDbCommand Cmm = new OleDbCommand();
Cmm.CommandText = "SELECT CodAutomaticProd, DescProd, BrandCod FROM tbProdutos WHERE ModelProd LIKE '%" + txtModel.Text + "%' AND YearProd LIKE '%" + txtYear.Text + " %' ";
Cmm.CommandType = CommandType.Text;
Cmm.Connection = Con;
OleDbDataReader DR;
DR = Cmm.ExecuteReader();
listBox1.Items.Clear();
while (DR.Read())
{
listBox1.Items.Add(DR.GetInt32(0) + " - " + DR.GetString(1) + " - " + DR.GetString(2));
}
The code runs perfectly within the BANK, and is within TRY
which does not indicate ERROR by "Exception".