private void textBox2_Leave(object sender, EventArgs e)
{
var carindex2 = (textBox2.Text.Trim()).ToUpper();
string connectionString = "Provider= OraOLEDB.Oracle; Data Source=TSTEEL;User ID=NEW_DBA;Password=tsteel";
string sql = "SELECT count(car_index) FROM CAR where car_index = '" + carindex2 + "'";
OleDbConnection connection = new OleDbConnection(connectionString);
OleDbCommand command = new OleDbCommand(sql, connection);
connection.Open();
int count = Convert.ToInt32(command.ExecuteScalar());
connection.Close();
if (count == 0)
{
MessageBox.Show("Car Index does not exist, Please try again!", "Car not found", MessageBoxButtons.OK, MessageBoxIcon.Error);
textBox2.Clear();
}
}