Lia*_*mGu 2 asp.net listbox asp.net-2.0 listbox-control
我目前正在尝试移动用户添加到列表框中的所有值,但是,我想要检索列表框中每个项目的实际值,而不是文本.
到目前为止,我已经得到了下面的代码,但这只得到文本而不是值.
For Each item In SelectedStoresLB.Items
Dim tCompany As Integer = CInt(Left(item.ToString, 1))
Dim tStore As String = Right(item.ToString, 3)
Dim tReason As String = ReasonTxt.Text
insertSQL = "INSERT INTO [CommsDownLog] ([DimCompanyID],[PervasiveStoreNumber],[DownReason]) VALUES (" & tCompany & ", '" & tStore & "', '" & tReason & "')"
Dim insertRow = New SqlCommand(insertSQL, objConn)
Try
objConn.Open()
insertRow.ExecuteNonQuery()
objConn.Close()
Catch ex As Exception
Response.Write(ex)
End Try
Next
Run Code Online (Sandbox Code Playgroud)
我如何获得集合中每个项目的价值?
归档时间: |
|
查看次数: |
3565 次 |
最近记录: |