This is a migrated thread and some comments may be shown as answers.

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

1 Answer 47 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Bee
Top achievements
Rank 1
Bee asked on 16 Nov 2012, 12:23 PM
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

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 21 Nov 2012, 07:57 AM
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,
Stefan
the Telerik team
Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
Tags
DropDownList
Asked by
Bee
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or