title: .net webservices, return more than 1 record
body: <p>i'm developing a .net webservices, but the result always return the first record only, how can i fix the while loop so it can return more than 1? below is the sample code:
  DAL.cs</p>
  
  <pre><code>using System;
  using System.Data;
  using System.Configuration;
  using System.Web;
  using System.Web.Security;
  using System.Web.UI.WebControls;
  using System.Web.UI.HtmlControls;
  using System.Data.SqlClient;
  using System.Collections.Generic;
  
  namespace Data
  {
      public class DAL
      {
          public static Model.customer GetCustomer(string custID)
          {
              string cs = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
              SqlConnection conn = null;
              SqlDataReader reader = null;
              try
              {
                  conn = new SqlConnection(cs);
                  string sql = "SELECT * FROM member WHERE userType = '" + custID + "'";
                  SqlCommand cmd = new SqlCommand(sql, conn);
                  conn.Open();
                  reader = cmd.ExecuteReader();
  
                  List&lt;Model.customer&gt; list = new List&lt;Model.customer&gt;();
  
                  while (reader.Read())
                  {
                      Model.customer cust = new Model.customer();
                      cust.customerID = reader["fullName"].ToString();
                      cust.contactName = reader["handphone"].ToString();
                      cust.companyName = reader["NRIC"].ToString();
                      list.Add(cust);
                  }
                  //error
                  return list;
                  //end of error
              }
              catch (Exception e)
              {
                  HttpContext.Current.Trace.Warn("Error", "error in getcustomer()", e);
              }
  
              finally
              {
                  if (reader != null) reader.Close();
                  if (conn != null &amp;&amp; conn.State != ConnectionState.Closed) conn.Close();
              }
              return null;
          }
      }
  }
  </code></pre>
  
  <p>customer.cs</p>
  
  <pre><code>using System;
  
  namespace Model
  {        
      public class customer
      {
          private string _customerID;
          private string _companyName;
          private string _contactName;
  
          public string customerID
          {
              get { return _customerID; }
              set { _customerID = value; }
          }
  
          public string companyName
          {
              get { return _companyName; }
              set { _companyName = value; }
          }
  
          public string contactName
          {
              get { return _contactName; }
              set { _contactName = value; }
          }
      }
  }
  </code></pre>
  
  <p>service.cs</p>
  
  <pre><code>using System;
  using System.Web;
  using System.Web.Services;
  using System.Web.Services.Protocols;
  using System.Collections.Generic;
  
  [WebService(Namespace = "http://tempuri.org/")]
  [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
  public class Service : System.Web.Services.WebService
  {
      public Service () {
  
          //Uncomment the following line if using designed components 
          //InitializeComponent(); 
      }
  
      [WebMethod]
      //public Model.customer GetCustomer(string custID)        
      public static List&lt;Model.customer&gt; GetCustomer(string custID)
      {        
          return Biz.BAL.GetCustomer(custID);
      }
  }
  </code></pre>
  
  <p>BAL.cs</p>
  
  <pre><code>using System;
  using System.Data;
  using System.Configuration;
  using System.Web;
  using System.Web.Security;
  using System.Web.UI.WebControls;
  using System.Web.UI.HtmlControls;
  using System.Data.SqlClient;
  using System.Collections.Generic;
  
  namespace Biz
  {
      public class BAL
      {
          public static List&lt;Model.customer&gt; GetCustomer(string custID)
          {
              Model.customer cust = Data.DAL.GetCustomer(custID);
              cust.companyName = cust.companyName;
              List&lt;Model.customer&gt; myList = new List&lt;Model.customer&gt;();
  
              myList.Add(cust);
  
              return myList;
          }
      }
  }
  </code></pre>