edit the current data save in table

Reply

Join Date: Jul 2008
Posts: 161
Reputation: ryan311 has a little shameless behaviour in the past 
Solved Threads: 1
ryan311 ryan311 is offline Offline
Junior Poster

edit the current data save in table

 
0
  #1
Mar 9th, 2009
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. .
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 807
Reputation: vb5prgrmr will become famous soon enough vb5prgrmr will become famous soon enough 
Solved Threads: 147
vb5prgrmr vb5prgrmr is offline Offline
Practically a Posting Shark

Re: edit the current data save in table

 
0
  #2
Mar 9th, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 2,092
Reputation: debasisdas will become famous soon enough debasisdas will become famous soon enough 
Solved Threads: 125
debasisdas's Avatar
debasisdas debasisdas is online now Online
Postaholic

Re: edit the current data save in table

 
0
  #3
Mar 9th, 2009
a single update statement will do , why you need a loop for that.
Share your Knowledge.
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 807
Reputation: vb5prgrmr will become famous soon enough vb5prgrmr will become famous soon enough 
Solved Threads: 147
vb5prgrmr vb5prgrmr is offline Offline
Practically a Posting Shark

Re: edit the current data save in table

 
0
  #4
Mar 10th, 2009
Originally Posted by debasisdas View Post
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.
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 2,092
Reputation: debasisdas will become famous soon enough debasisdas will become famous soon enough 
Solved Threads: 125
debasisdas's Avatar
debasisdas debasisdas is online now Online
Postaholic

Re: edit the current data save in table

 
0
  #5
Mar 10th, 2009
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.
Share your Knowledge.
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 807
Reputation: vb5prgrmr will become famous soon enough vb5prgrmr will become famous soon enough 
Solved Threads: 147
vb5prgrmr vb5prgrmr is offline Offline
Practically a Posting Shark

Re: edit the current data save in table

 
0
  #6
Mar 10th, 2009
True, but look at the logic originally used. Just trying to get poster to think about their logic...
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC