title: How to display records by matching the text in a textbox?
body: <p>I have two tables which is appointment table and medical centre which have relationship with each other using mcID. Right now my appointment form, i use outer join to display the mcCentre in medicalcentre table instead of mcID in the gridview. U see in my form, all medical centre(mcCentre) is displayed in the gridview. But I only want Hwang and Liang Family Clinic record to display as I want to match the text in the textbox which is Hwang and Liang Family Clinic. That means watever hospital text is in the textbox, I ony want that hospital record to appear in the gridview. the textbox name is txtCentre.</p>
  
  <p><img src="https://i.stack.imgur.com/fjnbo.jpg" alt="enter image description here"></p>
  
  <p><img src="https://i.stack.imgur.com/KMGDv.jpg" alt="enter image description here"></p>
  
  <pre><code> private void LoadAppointmentRecords()
  {
  
      //retrieve connection information info from App.config
      string strConnectionString = ConfigurationManager.ConnectionStrings["SACPConnection"].ConnectionString;
      //STEP 1: Create connection
      SqlConnection myConnect = new SqlConnection(strConnectionString);
      //STEP 2: Create command
      //string strCommandText = "SELECT appointmentID, convert(varchar, aDate, 103) AS aDate, aTime, aStatus, aContact, aHeight, aWeight, patientID, mcID, nurseID FROM APPOINTMENT";
  
      string strCommandText = "SELECT appointmentID, convert(varchar, aDate, 103) AS aDate, aTime, aStatus, aContact, aHeight, aWeight, pat.pFirstName, pat.pLastName, cen.mcCentre, nur.nUsername FROM APPOINTMENT AS app";
      strCommandText += " LEFT OUTER JOIN PATIENT as pat on app.patientid = pat.patientid";
      strCommandText += " LEFT OUTER JOIN MEDICALCENTRE as cen on app.mcid = cen.mcid";
      strCommandText += " LEFT OUTER JOIN NURSE as nur on app.nurseid = nur.nurseid";
      //strCommandText += " LEFT OUTER JOIN NURSE as nur on app.nurseid = nur.nurseid";
  
      AppointmentAdapter = new SqlDataAdapter(strCommandText, myConnect);
  
      //command builder generates Select, update, delete and insert SQL
      // statements for MedicalCentreAdapter
      //SqlCommandBuilder cmdBuilder = new SqlCommandBuilder(AppointmentAdapter);
      // Empty Employee Table first
      Appointment.Clear();
      // Fill Employee Table with data retrieved by data adapter
      // using SELECT statement
      AppointmentAdapter.Fill(Appointment);
  
      // if there are records, bind to Grid view &amp; display
      if (Appointment.Rows.Count &gt; 0)
          grdApp.DataSource = Appointment;
  }
  </code></pre>