| | |
Reading from a database
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Oct 2009
Posts: 25
Reputation:
Solved Threads: 0
I have a subscription system that i have developed. the system is supposed to automatically subtract the number of copies given to a client every monthend as per request they made of the copies required upon joining. my problem is i cant make my code run through my database so that it can subtract from every record....instaed it can deal with one record at a time. i cant manually subtract because the records at one time are going to reach thousands. i justa want it to automatically subtract from all fields when a button is clicked.
i have een trying to use this code but its not working.
i have een trying to use this code but its not working.
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
With rc .ActiveConnection = deSub.conn .LockType = adLockOptimistic .Source = "select * from cooperatesubs" .Open End With z = rc.Fields("numberofcopies") Do Until rc.EOF rc.AddNew rc.Fields("numberofcopies") = z rc.Fields("copiesgiven") = y rc.Fields("copiesremaining") = z - y rc.Update rc.MoveNext Loop Exit Sub
•
•
Join Date: Jan 2008
Posts: 255
Reputation:
Solved Threads: 37
0
#2 Oct 26th, 2009
Try the following -
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
With rc .ActiveConnection = deSub.conn .LockType = adLockOptimistic .Source = "select * from cooperatesubs" .Open End With Dim w As Integer Dim x As Integer Dim y As Integer Dim z As Integer Do Until rc.EOF = True y = rc.Fields("copiesgiven") z = rc.Fields("numberofcopies") x = z - y w = y + 1 rc.AddNew 'rc.Fields("numberofcopies") = z This will not change, for it is a set number, correct? rc.Fields("copiesgiven") = w rc.Fields("copiesremaining") = x rc.Update rc.MoveNext Loop Exit Sub
Please mark questions as answered when done.
Be the ONE!!!
Be the ONE!!!
•
•
Join Date: Oct 2009
Posts: 25
Reputation:
Solved Threads: 0
0
#3 34 Days Ago
i strongly believe the problem is with the part. its not moving to the next record wich makes it effective on one row only and fails to run through the database.
i was wondering isnt there any other way of doing this besides this one
thanx you
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
.movenext
i was wondering isnt there any other way of doing this besides this one
thanx you
![]() |
Similar Threads
- data retrieval trouble (JSP)
- Display Image from database (C#)
- Updating Records in Access Database C# OleDB (C#)
- import txt file sql database plz help! (C#)
- Displaying the content of the database in JTextArea (Java)
- Altering data when reading it from a database (MS SQL)
- How do add a blank choice to dropdownlist (VB.NET)
- radio button ASP question?? (ASP)
- Data Grid: How to include Hyperlinks (ASP.NET)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Try-Catch feature for VB6, VBA, VBScript
- Next Thread: If then Statement in excel using data in 2-3 columns
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age append application basic beginner birth bmp calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver subroutine table tags textbox time timer urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





