|
-
Sep 12th, 2002, 12:25 PM
#1
Thread Starter
Addicted Member
progressbar problem
hi
i am using vb 6 and ms access. i want to delete data from a table of an access database which contains about 5,000 records and i have a progressbar. But when the deletion process starts the progressbar should run as the records are deleted.
what i was thinking was to
1)first find out howmany records are present in the table
2)then divide that value with the progressbars max value,
3)delete the records with the remender that u get and increase the progressbar value by 1
but i am a bit confused with it so can u help me with some of ur ideas.
i am using adodc connection
can some one help me with the code.
Last edited by amit_m04; Sep 15th, 2002 at 02:28 AM.
-
Sep 12th, 2002, 12:27 PM
#2
you should be able to delete them in one statement that would take about a second... how are you going about deleting them.. you should use a sql delete statement
-
Sep 12th, 2002, 12:30 PM
#3
PowerPoster
if you're doing it in what Matt has properly pointed out would be the hard way of doing it yourself in a loop, and you really want to do it that way, and the progress bar doesn't progress, then you probably need a "doevents" in your loop.
-
Sep 12th, 2002, 12:49 PM
#4
Let me in ..
No matter what you are using for deletion of Records, i do not think you can achieve this task, unless, you could put some artificial intelligence in your program.
If you are going to write a loop to do this, and fire SQL query to delete the records one by one, you could achieve this, but thats a horrible way of deleting records. Its gonna take more time and resources.
If you fire only one SQL query to delete all, you cannot achieve this, because neither SQL nor VB tells you, while deleting the records, that how many records are already deleted.
-
Sep 12th, 2002, 12:58 PM
#5
Originally posted by techyspecy
If you fire only one SQL query to delete all, you cannot achieve this, because neither SQL nor VB tells you, while deleting the records, that how many records are already deleted.
and even on a slow connection/computer it would happen fast enough to not need a progress bar...
-
Sep 12th, 2002, 06:49 PM
#6
Frenzied Member
To make progressbar work for displaying deletion.. what you can do is;
Populate a Dynamic (pessimistic), recordset..
VB Code:
While NOt myRSet.EOF
myRSet.Delete
Progressbar1.value = Progressbar.value+1
myRSet.MoveNext
Wend
But this approach is really very slow.. you can delete the entire contents of the table using a single command..but if Progressbar is tooooooooooooooo necessary I think you have to use the above option..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|