While(Test_end_str<>'end') do
Begin
Temp_str1:=EXcelApp.Cells.Item[count,4].value; //get the darwing_no
Temp_str2:=EXcelApp.Cells.Item[count,2].value; //get the parts_id
Temp_str2:=EXcelApp.Cells.Item[count,6].value; //get the color_falg
Query1.SQL.Add('SELECT * FROM PARTS WHERE DRAWING_NO LIKE :STR1');
Query1.ParamByName('str1').AsString:=temp_str1;
Query1.Prepare;
Query1.ExecSQL;
Query1.UnPrepare;
Count_table:=Query1.RecordCount;
if(Count_table=0)Then
Begin
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('SELECT * FROM PARTS WHERE DRAWING_NO LIKE :STR1');
Query1.ParamByName('str1').AsString:=fornt_str;
Query1.Prepare;
Query1.ExecSQL;
Query1.UnPrepare;