Subitem不是listview项的成员 [英] Subitem is not a member of listview item
问题描述
我不知道为什么会这样。我想将listview数据插入到我的其他表中,但继续得到此错误子项不是listview项的成员。请帮帮我
我尝试了什么:
Private Sub orderButton_Click (发送者作为对象,e作为EventArgs)处理orderButton.Click
尝试
每个项目作为ListViewItem在myCart.Items中
Dim sql As新的StringBuilder
sql.AppendLine(INSERT INTO newMedicinesOrders)
sql.AppendLine(()
sql.AppendLine(, medicineName)
sql.AppendLine(,power)
sql.AppendLine(,form)
sql.AppendLine( ,fQuantity)
sql.AppendLine(,iQuantity)
sql.AppendLine(,type)
sql.AppendLine( ,费用)
sql.AppendLine())
sql.AppendLine(VALUES)
sql.AppendLine( ()
sql.AppendLine(,'& item.SubItems(1).Text &安培; ')
sql.AppendLine(,'& power.Text&')
sql.AppendLine(,'& Form .Text&')
sql.AppendLine(,'& fQuantity.Text&')
sql.AppendLine(,' & iQuantity.Text&')
sql.AppendLine(,'& Type.Text&')
sql.AppendLine (,'& iCost.Text&')
sql.AppendLine(,'& Type.Text&')
sql.AppendLine())
Dim命令As New MySqlCommand
command.CommandText = sql.ToString
command.Connection = con2
command.ExecuteNonQuery()
下一页
Catch ex As Exception
Response.Write(ex)
结束尝试
结束子
I don't know why this is happening. I want to insert my listview data to to my other table but keeps on getting this error subitem is not a member of listview item. Please help me
What I have tried:
Private Sub orderButton_Click(sender As Object, e As EventArgs) Handles orderButton.Click
Try
For Each item As ListViewItem In myCart.Items
Dim sql As New StringBuilder
sql.AppendLine(" INSERT INTO newMedicinesOrders ")
sql.AppendLine(" ( ")
sql.AppendLine(" ,medicineName")
sql.AppendLine(" ,power")
sql.AppendLine(" ,form")
sql.AppendLine(" ,fQuantity")
sql.AppendLine(" ,iQuantity")
sql.AppendLine(" ,type")
sql.AppendLine(" ,cost")
sql.AppendLine(" ) ")
sql.AppendLine(" VALUES ")
sql.AppendLine(" ( ")
sql.AppendLine(" ,'" & item.SubItems(1).Text & "' ")
sql.AppendLine(" ,'" & power.Text & "' ")
sql.AppendLine(" ,'" & Form.Text & "' ")
sql.AppendLine(" ,'" & fQuantity.Text & "' ")
sql.AppendLine(" ,'" & iQuantity.Text & "' ")
sql.AppendLine(" ,'" & Type.Text & "' ")
sql.AppendLine(" ,'" & iCost.Text & "' ")
sql.AppendLine(" ,'" & Type.Text & "' ")
sql.AppendLine(" ) ")
Dim command As New MySqlCommand
command.CommandText = sql.ToString
command.Connection = con2
command.ExecuteNonQuery()
Next
Catch ex As Exception
Response.Write(ex)
End Try
End Sub
推荐答案
Asp ListView的 ListViewDataItem [< a href =https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.listviewdataitem(v=vs.100).aspx\"target =_ blanktitle =New Window > ^ ]或 ListViewItem [ ^ ]类不包含名为SubItems
的 Property ,因此它不起作用。
可在Windows应用程序列表视图
控件中使用。 ListViewItem.SubItems属性(System.Windows。表格) [ ^ ]
你应该搜索这样的东西从listview项目uisng FindControl获取值 [ ^ ]
Asp ListView's ListViewDataItem[^] or ListViewItem[^] Classes doesnt contain Property calledSubItems
, so it wont work.
It is available inWindows Application ListView
Control. ListViewItem.SubItems Property (System.Windows.Forms)[^]
you should search something like this Get values from listview item uisng FindControl [^]
这篇关于Subitem不是listview项的成员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!