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