我需要帮助搞清楚如何编写使用来自多个listboxes
选择多个参数的SELECT
声明。然后我需要处理该行并将特定列返回到textboxes
。SQL SELECT语句
我所要做的是填补了第一listbox
与父项的列表,然后用三个listboxes
,我深入到一个特定的部分,然后填写textboxes
与最终选择的位置。
我至今是:
Private Sub GetPartDetails(ParentDesc As String, Description1 As String, Description2 As String, Description3 As String)
SQL.AddParameter("@ParentDesc", ParentDesc)
SQL.AddParameter("@Description1", Description1)
SQL.AddParameter("@Description2", Description2)
SQL.AddParameter("@Description3", Description3)
SQL.ExecQuery("SELECT TOP 1 * FROM PartsListMenu WHERE ParentItem = @ParentDesc AND FirstDescriptor = Description1 AND SecondDescriptor = @Description2 AND ThirdDescriptor = Descriptor3;")
For Each x As DataRow In SQL.DataBDataT.Rows
txtCabinet.Text = x("Cabinet")
txtDrawer.Text = x("Drawer")
txtRow.Text = x("Row")
txtSlot.Text = x("Slot")
txtQuantity.Text = x("Quantity")
Next
End Sub
以下是我呼吁基于什么已经在四个listboxes
选择了上面的代码。
Private Sub lbThirdDescriptor_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lbThirdDescriptor.SelectedIndexChanged
txtCabinet.Clear()
txtDrawer.Clear()
txtRow.Clear()
txtSlot.Clear()
GetPartDetails(lbParentItem.Text, lbFirstDescriptor.Text, lbSecondDescriptor.Text, lbThirdDescriptor.Text)
End Sub
的listboxes
是否正常工作,我已经验证了每个描述参数包含正确的listbox
选择,但是当我选择最后listbox
,该textboxes
不与任何东西填充。如果我缩小SELECT
声明一个参数,它将填补textboxes
用于从所选择的listbox
适当的项目,合适的位置信息。
感谢您指出了这一点。改变这个简单的错字可以解决问题。我一直在查看这段代码几个小时,但我从来没有发现过。总是有助于获得第二套代码。 –
我花了几个小时这个星期试图弄清楚为什么Tomcat的找不到一个特定的文件,直到我终于意识到我给了它错了名字。发生在我们所有人身上! – andreamc