Cara Menyimpan Data Di Listview VB.NET

 Berikut saya ada cara atau codingan untuk menyimpan data di listview vb.net

simpan listview vb.net
simpan listview vb.net
   Private Sub cmdsave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdsave.Click
call opendb()
Dim xKODE As String = ""
            Dim xNAMA As String = ""
            Dim xHARGA As Double = 0
            Dim xJUMLAH As Double = 0
            Dim xSUBTOTAL As Double = 0

            Dim MM As Integer = 0
            For MM = 0 To Me.lvpesen.Items.Count - 1
'lvpesen nama listview nya

                xKODE = lvpesen.Items(MM).Text
                xNAMA = lvpesen.Items(MM).SubItems(1).Text
                xHARGA = lvpesen.Items(MM).SubItems(2).Text
                xJUMLAH = lvpesen.Items(MM).SubItems(3).Text
                xSUBTOTAL = lvpesen.Items(MM).SubItems(4).Text

                Dim KK As String = ""
                KK = " INSERT INTO dpesenmakan " & _
                    "(no_pesen " & _
                " ,nama_makanan " & _
                " ,harga " & _
                " ,jumlah " & _
                " ,kode_makanan " & _
                " ,subtotal)" & _
                " VALUES " & _
                " ('" & txtnopesen.Text & "' " & _
                " ,'" & xNAMA & "' " & _
                " ,'" & xHARGA & "' " & _
                " ,'" & xJUMLAH & "' " & _
                " ,'" & xKODE & "' " & _
                " ,'" & xSUBTOTAL & "') "
                cmd = New OleDb.OleDbCommand(KK, conn)
                cmd.ExecuteNonQuery()
                cmd.Dispose()
            Next
end sub

4 komentar:

  1. bro itu call opendb() maksudnya apa? tolong di jelaskan
    terima kasih

    BalasHapus
  2. bro boleh liat sourcecode projectnya ? kalo boleh kirim ke [email protected]

    BalasHapus