我試圖從列表字段中保存多個數據,如何一次保存所有數據? 我已經嘗試此代碼在VB.net中太多參數'''
Dim detail As New Detail
Dim detailBr As New DetailBridge
Dim i As Integer
For i = 0 To lstProduct.Items.Count - 1
detail = detailBr.Insert(Convert.ToInt32(ddlGroup.SelectedValue), lstProduct.Items(i).Value) 'error was here
Next
,但我得到了一個lstProduct.Items(i).Value
錯誤的錯誤說
太多的參數「...」
我不知道錯誤是什麼。
任何人都可以幫忙嗎?謝謝你的建議。
UPDATE:detailBr
是類和代碼
Public Function Insert(ByVal GroupID As Integer, ByVal ProductID As String) As Boolean
Dim iResult As Integer
Dim arrColumn() As String = {"GroupID", "ProductID"}
Dim arrValue() As Object = {GroupID, ProductID}
oConn.Open()
Dim SQLString As String = GenInsert("DetailGroup", arrColumn, arrValue)
Try
iResult = SCommand.Execute(SQLString, oConn)
Catch ex As Exception
Throw ex
Finally
oConn.Close()
End Try
If iResult > 0 Then
Return True
Else
Return False
End If
End Function
無論'detailBr'是什麼,插入方法不需要2個參數 – Plutonix
'detailBr'是類,已經更新我的問題。 – JTR
什麼是lstProduct,ListBox?它存儲一個類型? – Plutonix