operator & not defined for string "select...." and data rowview

2 posts, 0 answers
  1. Bee
    Bee avatar
    11 posts
    Member since:
    Nov 2012

    Posted 16 Nov 2012 Link to this post

    i have 2 ddls and i want to populate the second one based on the value of the first one. so i went on to use a row filter to filter the data view to get the data i need on the second ddl but when the page loads i get the error operator & not defined for string "Select distinct Zones....." and data row view. i click ok on the dialog error box to close it and it goes on to open the form and the code actually works. so how do i get rid of the error

    cmd.CommandText = "Select Distinct Zones.ZoneID,CustomerItems.CustomerID as CustomerID,Zones.Zone " & _
    "From CustomerItems Inner Join Zones On Zones.ZoneID=CustomerItems.ZoneID " & _
    "Inner Join StockItems On StockItems.StockID=CustomerItems.StockID Where CustomerItems.CustomerID='" & ddlCustomers.SelectedValue & "'"
    da = New SqlDataAdapter(cmd)
    da.Fill(ds, "Zones")

    'Populate Zones
    ddlZone.DisplayMember = "Zone"
    ddlZone.ValueMember = "ZoneID"
    ddlZone.DataSource = ds.Tables("Zones")

    setup = False
    If Not setup Then
    Dim dv As DataView
    dv = New DataView(ds.Tables("Zones"))
    'dv.RowFilter = "CustomerID = '" & ddlCustomers.SelectedValue & "'"
    dv.RowFilter = "[CustomerID] = " & ddlCustomers.SelectedValue
    ddlZone.DataSource = dv
    ddlZone.ValueMember = "ZoneID"
    ddlZone.DisplayMember = "Zone"
    setup = False
    End If
  2. Stefan
    Stefan avatar
    2911 posts

    Posted 21 Nov 2012 Link to this post

    Hi Bee,

    Thank you for writing.

    It seems that your question is related to an error raised when you build your sql command. If so, please note that the way you build up your data is not directly related to our controls, thus is falls out of the scope of our support services. Please address your question to the appropriate MSDN forums.

    If you think that this is something related to our controls, please get back to us with a sample code allowing us to reproduce it, a sample data base and the exact steps that we should follow to replicate the experienced error on our end. Also, please confirm that you are using RadControls for WinForms.
    Kind regards,
    the Telerik team
    Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
Back to Top