public static List <Amazing_charts_sample_program_Patient_Format> getFirstName1(List <Amazing_charts_sample_program_Patient_Format> dataSet, Patient _patient) { string query = "SELECT * from credentials where first_name like '" + _patient.FirstName + "%'"; if (_patient.LastName.Length > 0) { query += " AND last_name like '" + _patient.LastName + "%'"; } if (_patient.DateOfBirth.Length > 0) { query += " AND date_of_birth like '" + _patient.DateOfBirth + "%'"; } var response = new FirstNameClass().PerformQuery(query); if (response.hasErrors == true) { return(dataSet); } int index = 0; while (response.reader.Read()) { Patient patient = new Patient(); patient.FirstName = response.reader["first_name"].ToString(); patient.LastName = response.reader["last_name"].ToString(); patient.DateOfBirth = response.reader["date_of_birth"].ToString(); patient.PhoneNumber = response.reader["phone"].ToString(); string[] tempDate = Helper_Classes_namespace.HelperClass.getSystemDateTime().Date.ToString().Split(' '); patient.Age = Helper_Classes_namespace.HelperClass.getTotAge(patient.DateOfBirth, tempDate[0]); dataSet.Insert(index, patient); index++; } Helper_Classes_namespace.DataBaseHelperClass.ClosePerformQuery(); return(new FirstNameClass().QuickSortNow(dataSet, 0, dataSet.Count - 1)); }