Dim iCount As Integer
Dim iLoop As Integer
Dim query3 As New MySqlCommand
Dim lvitem
ConnectDatabase()
cona.Open()
iCount = lvLogs.Items.Count
If Not lvLogs.Items.Count = 0 Then
Do Until iLoop = lvLogs.Items.Count.ToString
lvitem = lvLogs.Items.Item(iLoop).ToString
With lvitem
query3.CommandText = "insert into wer(CustomerName, SalesGroup, CustomerType, TypeOfIndustry, RM, Senior_RM) values " _
& "('" & .SubItems(0).Text & "','" & .SubItems(1).Text & "','" & .SubItems(2).Text & "','" & .SubItems(3).Text & "','" & .SubItems(4).Text & "','" & .SubItems(5) & "')"
query3.ExecuteNonQuery()
End With
iLoop = iLoop + 1
lvitem = Nothing
MsgBox("New record added!")
Loop
End If
i think my error is declaration of variable type.
CAN SOMEBODY HELP ME?
this code is use to save imported excel file to list view then from listview, it will be saved in the DATABASE.

New Topic/Question
Reply



MultiQuote






|