public ProblemReport getOneDeletedReportByID(int problemID, MySqlConnection conn) { conn.Open(); MySqlCommand cmd = new MySqlCommand("SELECT `problem_report`.`Problem_ID`, `problem_report`.`Photo`, `problem_report`.`Reason`, `problem_report`.`Order_ID`, `problem_report`.`Date_Deleted`, `customer`.`Customer_Surname`, `customer`.`Customer_GivenName`, `customer`.`Regeion_Code`, `customer`.`Mobile_Phone_No`, " + "`problem_report`.`Report_date`, `problem_report`.`Return_date` FROM `problem_report`, `customer`, `order` " + "WHERE `problem_report`.`Order_ID`=`order`.`Order_ID` AND `order`.`Customer_ID`=`customer`.`Customer_ID` AND `problem_report`.`Date_Deleted` IS NOT NULL AND `problem_report`.`Problem_ID`=@problemID", conn); cmd.Parameters.AddWithValue("@problemID", problemID); cmd.Prepare(); MySqlDataAdapter adapter = new MySqlDataAdapter(cmd); DataTable dt = new DataTable(); adapter.Fill(dt); ProblemReport problemReport = new ProblemReport(); foreach (DataRow item in dt.Rows) { problemReport.setProblemID(int.Parse(item["Problem_ID"].ToString())); problemReport.setPhoto(ImageConverter.byteArrayToImage((byte[])item["Photo"])); problemReport.setReason(item["Reason"].ToString()); problemReport.setOrderID(((uint)item["Order_ID"]).ToString("0000000000")); problemReport.setCustSurname(item["Customer_Surname"].ToString()); problemReport.setCustGivenName(item["Customer_GivenName"].ToString()); problemReport.setCustRegeionCode((int)item["Regeion_Code"]); problemReport.setCustMobilePhoneNo((int)item["Mobile_Phone_No"]); problemReport.setReportDate(Convert.ToDateTime(item["Report_date"])); if (!Convert.IsDBNull(item["Return_date"])) { problemReport.setReturnDate(Convert.ToDateTime(item["Return_date"])); } problemReport.setDateDeleted(Convert.ToDateTime(item["Date_Deleted"])); } conn.Close(); return(problemReport); }