I keep getting this annoying error followed by a really long message when trying to retrieve and match data from database, here is the code
try
{
string connection = @"Provider=Microsoft.ACE.OLEDB.12.0;" + @"Data Source=c:\Users\PC\Documents\Visual Studio 2013\Projects\WindowsFormsApplication1\WindowsFormsApplication1\Main database.accdb";
string Query = "SELECT * FROM [Firebird m0 Damage] WHERE textBox15= '" + comboBox6.SelectedIndex + "'";
OleDbConnection me = new OleDbConnection(connection);
OleDbCommand constr = new OleDbCommand(Query, me);
me.Open();
OleDbDataReader reader = constr.ExecuteReader();
constr.Parameters.Add("Total price");
while (reader.Read())
{
textBox15.Text = reader["Total price"].ToString();
}
me.Close();
}
catch (Exception ex)
{
MessageBox.Show("Error " + ex);
}
}
I have a datatable with 2 columns, parameter change and total price, i have also populated my combobox with the 1st column, when i select a value it should return data from the 2nd column but in the same row, however mine won't work