title: Conversion failed when converting the varchar value '[]' to data type int
body: <p>I'm trying to create a search function that uses a TextBox and two DropDownLists to return entries from my MSSQL DB. The way I have it set up is by passing the search queries via QueryStrings to a GridView on a separate page. Here's what I have for the search function:</p>
  
  <pre><code>
  Partial Class Includes_LeftCol
    Inherits System.Web.UI.UserControl
  
    Public Sub btnSearch_Click(sender As Object, e As System.EventArgs) Handles btnSearch.Click
  
      Dim SelectURLRangePrice As String
  
      If tbxSearch.Text.Length = 0 And ddlRangeName.SelectedValue = "" And ddlPriceRange.SelectedValue = "" Then
  
        SelectURLRangePrice = "SearchResults.aspx"
        Response.Redirect(SelectURLRangePrice)
  
      ElseIf tbxSearch.Text.Length = 0 And ddlRangeName.SelectedValue = "" And ddlPriceRange.SelectedValue.Length > 0 Then
  
        SelectURLRangePrice = "SearchResults.aspx?price=" & ddlPriceRange.Text
        Response.Redirect(SelectURLRangePrice)
  
      ElseIf tbxSearch.Text.Length = 0 And ddlRangeName.SelectedValue.Length > 0 And ddlPriceRange.SelectedValue.Length > 0 Then
  
        SelectURLRangePrice = "SearchResults.aspx?range=" & ddlRangeName.Text & "&price=" & ddlPriceRange.Text
        Response.Redirect(SelectURLRangePrice)
  
      End If
  
      Dim SelectURLRange As String
  
      If tbxSearch.Text.Length = 0 And ddlRangeName.SelectedValue.Length = 0 Then
  
        SelectURLRange = "SearchResults.aspx"
        Response.Redirect(SelectURLRange)
  
      ElseIf tbxSearch.Text.Length = 0 And ddlRangeName.SelectedValue.Length > 0 Then
  
        SelectURLRange = "SearchResults.aspx?range=" & ddlRangeName.Text
        Response.Redirect(SelectURLRange)
  
      End If
  
      Dim SelectURL As String
  
      If tbxSearch.Text.Length = 0 Then
  
        SelectURL = "SearchResults.aspx"
        Response.Redirect(SelectURL)
  
      ElseIf tbxSearch.Text.Length > 0 Then
  
        SelectURL = "SearchResults.aspx?search=" & tbxSearch.Text
        Response.Redirect(SelectURL)
  
      End If
  
    End Sub
  
  End Class
  </code></pre>
  
  <p>And here's my SQL statement:</p>
  
  <pre><code>
  
      SELECT        Product_Rental, Product_ID, Range_Name, Model_Name, Product_Name, Product_Year, Product_Code, Product_Active, Product_DateAdded
      FROM            Products
      WHERE        (Range_Name LIKE '%' + @Range_Name + '%') OR
                               (Model_Name LIKE '%' + @Model_Name + '%') OR
                               (Product_Name LIKE '%' + @Product_Name + '%') OR
                               (Product_Code LIKE '%' + @Product_Code + '%') OR
                               (Product_Year LIKE '%' + @Product_Year + '%') OR
                               (Product_Rental BETWEEN @Product_Rental AND @Product_Rental + 50)
  
  </code>
  </pre>
  
  <p>Once submitted, I get the following error:</p>
  
  <p><strong>Conversion failed when converting the varchar value '[e.g. 209.35]' to data type int.</strong></p>
  
  <p>I'm a beginner at this so apologies if it's something stupid, and I've tried to go as far as I can before posting, but I just can't get past this.</p>
  
  <p>Thanks in advance.</p>