Subitem不是listview项的成员 [英] Subitem is not a member of listview item

查看:69
本文介绍了Subitem不是listview项的成员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道为什么会这样。我想将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 called SubItems, so it wont work.
It is available in Windows 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆