title: Conversion failed when converting the nvarchar value '%' to data type int
body: <p>I have an Object Data Source which pulls information from the database where if we don'd have a value for this particular parameter then we want to get all records. So I have a LIKE statement and I'm using a wildcard to return all entries, but this is giving me the error message </p>
  
  <blockquote>
    <p>System.Data.SqlClient.SqlException (0x80131904): Conversion failed when converting the nvarchar value '%' to data type int. </p>
  </blockquote>
  
  <p>The table structure for the relevant column is:</p>
  
  <pre><code>[columnName] VARCHAR(50)
  </code></pre>
  
  <p>The SQL is something similar to:</p>
  
  <pre><code>SELECT [columns] from [table] where [column] LIKE @param
  </code></pre>
  
  <p>Then in VB I add the parameter:</p>
  
  <pre><code>Dim sessionParam As New Parameter
  sessionParam.Name = "param"
  sessionParam.DefaultValue = "%"
  sessionParam.Type = TypeCode.String
  SqlDataSource1.SelectParameters.Add(sessionParam)
  </code></pre>
  
  <p>So far I've tried casting the parameter value, casting the column, using dbType for the parameter instead of type, but nothing seems to work and I just get the same error. I suspect the column is reading as an int as this column is a mix of values so some are numbers, some are text, therefore SQL is making the 'educated guess' that that value needs to be an int</p>