title: Error Unable to cast object of type 'System.Int32' to type 'System.String'
body: <p>I am using below function to get values from database.</p>
  
  <p>The problem is when i select column of type int.</p>
  
  <p>i get this error <code>Unable to cast object of type 'System.Int32' to type 'System.String'.</code> </p>
  
  <p>in this line <code>result.Add(dr.GetString(0));</code></p>
  
  <p><strong>Code</strong></p>
  
  <pre><code>[WebMethod]
  public static List&lt;string&gt; GetAutoCompleteData(string value, string filterBy)
  {
      string strConnString = ConfigurationManager.ConnectionStrings["ConnString"].ConnectionString;
      using (SqlConnection con = new SqlConnection(strConnString))
      {
          con.Open();
          string command = string.Format("select {0} from Users where {0} LIKE '%'+@SearchText+'%'", filterBy);
          using (SqlCommand cmd = new SqlCommand(command, con))
          {
              cmd.Parameters.AddWithValue("@SearchText", value);
  
              using (SqlDataReader dr = cmd.ExecuteReader())
              {
                  List&lt;string&gt; result = new List&lt;string&gt;();
                  while (dr.Read())
                  {
                      result.Add(dr.GetString(0));
                  }
                  return result;
              }
          }
      }
  }
  </code></pre>
  
  <p><strong>Users table structure</strong></p>
  
  <pre><code>UserID   type int
  UserName type nvarchar(50)
  Password type nvarchar(50)
  </code></pre>