Hi I'm new to C# and I have a windows form with a textbox Barcode_txtBx
and a button Search_btn
which filters records in a Data Table dt
to one record and have another textbox Manufacturer_txtBx
to display the data table column Manufacturer. I can do the filtering but I can't find a way to display the relevant column in the textbox Manufacturer_txtBx
. This is the code I have so far.
private void Search_btn_Click(object sender, EventArgs e)
{
connection.Open();
OleDbCommand command = new OleDbCommand();
command.Connection = connection;
command.CommandText = "Select * from BookInTable where Barcode = '" + Barcode_txtBx.Text + "'";
OleDbDataReader reader = command.ExecuteReader();
DataTable dt = new DataTable();
dt.Load(reader);
Manufacturer_txtBx.Text = "";
connection.Close();
}
At the moment Manufacturer_txtBx is displaying an empty string just so I don't get an error