我正在尝试根据来自选中列表框的用户输入执行 SQL 选择查询。我能够找到一些代码,但该解决方案似乎不起作用。在调试时,它一直在第 3 行出现问题,我不知道为什么。
任何帮助将不胜感激。
Dim DistrictString As StringBuilder = New StringBuilder()
For h = 0 To Me.District.CheckedItems.Count - 1
If Me.District.CheckedItems(h).Selected Then
DistrictString.Append(Me.District.CheckedItems(h).Value & ",")
End If
Next
有了一些建议,这里是新编辑的代码版本,它现在在 Append 行上崩溃了。
新错误是“未找到类型“字符串”的公共成员“值”
Dim DistrictW As String
Dim DistrictX As String
Dim DistrictString As StringBuilder = New StringBuilder
For h = 0 To Me.District.CheckedItems.Count - 1
DistrictString.Append(Me.District.CheckedItems(h).Value & ",")
Next
DistrictW = DistrictString.ToString
DistrictX = DistrictW.Substring(0, DistrictString.Length - 1)