943,657 Members | Top Members by Rank

Ad:
Mar 9th, 2009
0

edit the current data save in table

Expand Post »
all i want is change all the record in my table if the pcarrier="Credit" but my problem is only one data have been changes. .

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Set rs = New ADODB.Recordset
  2. rs.Open "Select * from Soldto where cno='" & Combo1.Text & "'", cn, adOpenKeyset, adLockPessimistic
  3. If rs!pcarrier = "Credit" Then
  4. Do Until rs.EOF
  5. rs!pcarrier = "Paid"
  6. rs.MoveNext
  7. rs.Update
  8. Loop
  9. End If

help thanks. .
Similar Threads
Reputation Points: 3
Solved Threads: 5
Posting Whiz in Training
ryan311 is offline Offline
254 posts
since Jul 2008
Mar 9th, 2009
0

Re: edit the current data save in table

Try something like...
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. If rs.BOF = False AND rs.EOF = False AND rs.RecordCount <> 0 Then
  2. rs.MoveFirst
  3. Do While Not Rs.EOF
  4. rs.Edit
  5. rs!pcarrier = "Paid"
  6. rs.Update
  7. rs.MoveNext
  8. Loop
  9. End If
Reputation Points: 156
Solved Threads: 296
Posting Virtuoso
vb5prgrmr is offline Offline
1,670 posts
since Mar 2009
Mar 9th, 2009
0

Re: edit the current data save in table

a single update statement will do , why you need a loop for that.
Featured Poster
Reputation Points: 665
Solved Threads: 427
Posting Genius
debasisdas is offline Offline
6,406 posts
since Feb 2007
Mar 10th, 2009
0

Re: edit the current data save in table

Click to Expand / Collapse  Quote originally posted by debasisdas ...
a single update statement will do , why you need a loop for that.
I agree, but original poster is using loop and I am trying to help them with the logic of the loop and as to why only one of multiple records are being updated.
Reputation Points: 156
Solved Threads: 296
Posting Virtuoso
vb5prgrmr is offline Offline
1,670 posts
since Mar 2009
Mar 10th, 2009
0

Re: edit the current data save in table

that ok, but updating records in a loop is not recommended as it takes a lot of system resources. and you have to commit very frequently , which again has a lot of side effects.
Featured Poster
Reputation Points: 665
Solved Threads: 427
Posting Genius
debasisdas is offline Offline
6,406 posts
since Feb 2007
Mar 10th, 2009
0

Re: edit the current data save in table

True, but look at the logic originally used. Just trying to get poster to think about their logic...
Reputation Points: 156
Solved Threads: 296
Posting Virtuoso
vb5prgrmr is offline Offline
1,670 posts
since Mar 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: How to di this....
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: MS Access - load record to form from button click on another?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC