sir patulong poh....kasi pag nag add ako ng unang data successful siya pero pangalawa na pataas ito po sinasabi nya " InvalidArgumen = 'Value of '4' is not 'valid for 'index'.
parameter name:index"..paano po ba ang tamang code sir???patulong naman po..ito po code ko..nkaatach na rin pix para sa detalye...
Code:Sub savedata() Dim x As Integer Dim val As Integer Try If Not ListView1.Items.Count = 0 Then Do Until iloop = ListView1.Items.Count Dim LvItem = ListView1.Items.Item(iloop) With LvItem If Me.Enabled = True Then sqlQRY = "insert into LibTransaction(BorrowersID,BookNo,DateBorrow,DateDue,NoofCopy,Status)" sqlQRY = sqlQRY & "values" sqlQRY = sqlQRY & "('" & txtid1.Text & "','" & LvItem.SubItems(0).Text & "',#" & LvItem.SubItems(3).Text & "#,#" & LvItem.SubItems(4).Text & "#, '" & LvItem.SubItems(5).Text & "','" & a & "')" cmd = New OleDbCommand(sqlQRY, conn) cmd.ExecuteNonQuery() sqlQRY = "select BookRemain from BookInfo where BookNo = '" & LvItem.SubItems(0).Text & "' " cmd = New OleDbCommand(sqlQRY, conn) cmd.ExecuteNonQuery() dr = cmd.ExecuteReader dr.Read() x = dr("BookRemain") dr.Close() val = Integer.Parse(x) Num = val - Integer.Parse(LvItem.SubItems(5).Text) LvItem.SubItems(5).Text = Num sqlQRY = "Update BookInfo Set BookRemain ='" & LvItem.SubItems(5).Text & "' where BookNo ='" & LvItem.SubItems(0).Text & "'" cmd = New OleDbCommand(sqlQRY, conn) cmd.ExecuteNonQuery() Else End If End With iloop = iloop + 1 LvItem = Nothing Loop End If Catch ex As Exception MsgBox(ex.Message.ToString) End Try End Sub
possible yung listview na nacacall mo is null or wala kaya mo nerereceive yang error na yan