Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to calculate the time it would take to fill a dataset vb.net 2003??

Posted on 2007-03-23
6
Medium Priority
?
397 Views
Last Modified: 2010-04-23
Experts, is there anyway to calculate the time it would take to connect to a database and fill a dataset using vb.net?
What I am trying to do is use a progress bar to show the progress of a database connect and retrieval of data, what I would need is to know how long before hand it would take to execute this line of code
ora.fill(ds, "Table1)

Once I got the "time" I could set a  timers intervals based on the "time" divided by the max value of the progress bar.   Any ideas on how to do this?

  Dim ssql As String = "select [Part#] as PartNumber, SerialNumber, AutoNumberID, Quantity from DailyBuildList " & _
                "Where Uploaded = 0"
            Dim ora As OleDbDataAdapter = New OleDbDataAdapter(ssql, accessconn)
            Dim org, status As Integer
            Dim dr As DataRow
                ora.Fill(ds, "Table1")
0
Comment
Question by:tentavarious
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 35

Expert Comment

by:YZlat
ID: 18782488
Dim ssql As String = "select [Part#] as PartNumber, SerialNumber, AutoNumberID, Quantity from DailyBuildList " & _
                "Where Uploaded = 0"
Dim startTime, endTime as DateTime
Dim diff as Integer
startTime=Datetime.Now
            Dim ora As OleDbDataAdapter = New OleDbDataAdapter(ssql, accessconn)
            Dim org, status As Integer
            Dim dr As DataRow
                ora.Fill(ds, "Table1")
endTime=Datetime.Now

diff=CInt(DateDiff(DateInterval.Minute, startTime, endTime))
0
 
LVL 35

Expert Comment

by:YZlat
ID: 18782495
or to get time in seconds, use

diff=CInt(DateDiff(DateInterval.Second, startTime, endTime))
0
 

Author Comment

by:tentavarious
ID: 18782585
Yeah, that's not what I need, if I have the time after its already completed it does me no good.  I need to calculate how long it would take before hand, that way I can show a percentage of how much time is left before its completed.  Kinda like when your downloading something, how does it it know how long it will take before its completed the download?  That is what I am looking for.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 35

Assisted Solution

by:YZlat
YZlat earned 200 total points
ID: 18782813
I don't htink you can do that. You cannot find out how long something will take before it even started. You never know, the database might be slow one day so you cannot really predict anything
0
 
LVL 17

Expert Comment

by:ZeonFlash
ID: 18782858
I agree with YZlat:  it's nearly impossible to tell how long it's going to take to do operations on the database.  You could benchmark the operation a couple times and take the average time as your base, but it won't necessarily be accurate.  As YZlat stated, the database could be slow that day, or it could be that the database was slow the day you did the benchmarks.  Either way, it'd be hit-and-miss.

When downloading a file, it's fairly easy to determine the time left because you know how much of the file is left to download and what speed it's coming down at.  When querying a database, you could return 0 records or 1 million records....the number of which you don't know until you've actually received the records from the database.
0
 
LVL 34

Accepted Solution

by:
Sancler earned 800 total points
ID: 18783781
Here's a recent PAQ

http://www.experts-exchange.com/Programming/Languages/.NET/Visual_Basic.NET/Q_22458971.html?cid=236#a18760478

Doing it the way described in the Accepted Answer slows things down.  But there is mention, earlier in the thread, of an alternative approach - using the .Fill method with startRecord and batchSize set.

Roger
0

Featured Post

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question