I have tried alot of changes from previous posts. Does anyone know what could be cause this?
(I know the code shouldn't be used from a security point of view but its a small local based system)
Con.Open();
oleDbCmd.Connection = Con;
OleDbDataReader rdr = null;
OleDbCommand cmd = new OleDbCommand("select * from Customers", Con);
rdr = cmd.ExecuteReader();
while (rdr.Read())
{
Int32 intChech = Convert.ToInt32(cboCustomerID.Text);
if (intChech == (Int32)rdr.GetValue(0))
{
txtTitle.Text = (string)rdr.GetValue(1);
txtSurname.Text = (string)rdr.GetValue(2);
txtForename.Text = (string)rdr.GetValue(3);
txtAddress.Text = (string)rdr.GetValue(4);
txtTown.Text = (string)rdr.GetValue(5);
txtCounty.Text = (string)rdr.GetValue(6);
txtPostCode.Text = (string)rdr.GetValue(7);
txtTelephone.Text = (string)rdr.GetValue(8);
}
}
//PULL DATABASE INFORMATION FOR CAR INFO
string strSearch = Convert.ToString(cboCustomerID.Text);
string strSQL = @"select * from Hire if [Customer ID] = '";
OleDbDataAdapter dAdapter1 = new OleDbDataAdapter(strSQL, Con);
OleDbCommandBuilder cBuidler1 = new OleDbCommandBuilder(dAdapter1);
DataTable dataTable1 = new DataTable();
DataSet ds1 = new DataSet();
dAdapter1.Fill(dataTable1);
for (int i = 0; i < dataTable1.Rows.Count; i++)
{
dgHire1.Rows.Add(dataTable1.Rows[i][0], dataTable1.Rows[i][1], dataTable1.Rows[i][2],
dataTable1.Rows[i][3], dataTable1.Rows[i][4]);
}
}
strSQL. Exactly what should that customer id be?