save data in sql using listview

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sigridish
    New Member
    • Nov 2011
    • 4

    save data in sql using listview

    Code:
    Dim lvitem
    Dim iCount As Integer
    Dim iLoop As Integer
    Dim query3 = New SqlCommand
    query3.Connection = New SqlConnection("SERVER=localhost;UID=root;DATABASE=test")
    iCount = lvLogs.Items.Count()
    If Not lvLogs.Items.Count = 0 Then
    Do Until iLoop = lvLogs.Items.Count
     
    LvItem = lvLogs.Items.Item(iLoop)
    With LvItem
    query3.CommandText = "insert into wer(CustomerName,SalesGroup,CustomerType,TypeOfIndustry,RM,SeniorRM) values('" & .SubItems(0).Text & "','" & .SubItems(1).Text & "','" & .SubItems(2).Text & "','" & .SubItems(3).Text & "','" & .SubItems(4).Text & "','" & .SubItems(5).Text & "')"
    query3.ExecuteNonQuery()
    End With
     
    iLoop = iLoop + 1
    LvItem = Nothing
    Loop
    End If
    MessageBox.Show("Record Saved!")
    message box show up but data does not save in my database. kindly help me please?
Working...