if not MySQLQuery1.Prepared then begin MySQLQuery1.Close; MySQLQuery1.Prepare; MySQLQuery1.Open end;