Arithmetic operations with time

Hi all,
I want to do arithmetic operations with time data types. Like
d1,d2,d3 are of date types
long diff = d1.getTime()-d2.getTime()-d3.getTime();
long hours = diff/(60 * 60 * 1000) % 24);
long mins = diff / (60 * 1000) % 60;
long secs =  diff / 1000 % 60;
When i am entering time for d1 as 4:00:00, d2 as 9:00:00 and d3 as 1:00:00, i am getting hours & mins in negative values.
Can anyone suggest how to do this operation

hi sahithi,
when d1 d2 and d3 are date types how can u enter or set 4:00:00 to it, which is time representation.
what exactly u are trying to do ...
and it is obvvious that d1-d2-d3 is 4:00:00 -9:00:00 -1:00:00 here u can see that 9 is greater and its sign is predominant according to this expression. hence diff is negative value. and then as usuall hours and secs are also in negative.
any how follow below code you can solve yoru issue i hope
String fromdate = "11/03/14 09:29:58";
    String enddate = "11/03/14 09:33:43";
    Custom date format
    SimpleDateFormat format = new SimpleDateFormat("yy/MM/dd HH:mm:ss");
    Date d1 = null;
    Date d2 = null;
    try {
        d1 = format.parse(dateStart);
        d2 = format.parse(dateStop);
    } catch (ParseException e) {
        e.printStackTrace();
    long diff = d2.getTime() - d1.getTime();
    long diffSeconds = diff / 1000 % 60;  // for seconds
    long diffMinutes = diff / (60 * 1000) % 60; // for minute
    long diffHours = diff / (60 * 60 * 1000); // for hours
wdComponentAPI.getMessageManager().reportSuccess
("Seconds---> " + diffSeconds +"sec");
wdComponentAPI.getMessageManager().reportSuccess
("Minutes---> " + diffMinutes + " min.");
wdComponentAPI.getMessageManager().reportSuccess
("Hours--->" + diffHours + " hrs.");
Regards
Govardan

Similar Messages

  • Using Modulus (%) arithmetic operator with decimals

    When trying to use the arithmetic operator modulus with decimals there seem to be some errors in the results. Is there a restriction on the number/value of decimals that can be used with this operator? Am I perhaps just using it incorrectly?
    example ...
    Double valA= new Double("12.4");
    Double valB = new Double("1236");
    double result = valB.floatValue() % valA.floatValue();
    System.out.println("valB : " + valB );
    System.out.println("valA: " + valA);
    System.out.println("result : " + result);
    produces :
    valB : 1236.0
    valA : 12.4
    result : 8.40003776550293
    But :
    Double valA= new Double("12.5");
    Double valB = new Double("1236");
    double result = valB.floatValue() % valA.floatValue();
    System.out.println("valB : " + valB );
    System.out.println("valA: " + valA);
    System.out.println("result : " + result);
    produces :
    valB : 1236.0
    valA : 12.5
    result : 11.0

    Floating point arithmetic in general is not exact. The problem is that you are expecting exact results.
    In the second example where you use 12.5 and 1236.0 is just so happens that both of those numbers can be represented exactly, so you do get an exact result.

  • Arithmetic operations with date characteristics.

    Hi gurus....i want to to subtract 2 time characteristics directly in BEx so i can get de difference between 2 dates. how can i do it?
    In fact the specific requirement is to subtract from de execution query date a time characteristic.
    Is there a sysdate variable that gives me the execution date of the query??? or i have to use a user exit variable to do this?
    Thanks and regards.

    hi Rafael,
    take a look
    http://www.sd-solutions.com/documents/SDS_BW_Replacement%20Path%20Variables.html
    hope this helps.

  • Formating and operating with integer values

    I am new to XML Publisher.
    I have a task to make a layout using rtf. The problem is that I must do an arithmetical operation using data generated from a system report. I must not modify the report!!!
    The value retrieved from report is of X.Y format which means a time period (X - years, Y - months). So I want to split this value in two - one for years and other for months with a posibility of making arithmetical operations over them. Is it possible?? And if so, cand anybody give me a solution for this...?

    ok, back to the problem. As I red in the XML Publihser Users Guide there is a posibility to transform strings in numbers, but I can't figure out how it works! As speaking of my problem I can not do arithmetical operations with that value (YEARS.MONTHS). I tried the to_number function described in XML Publisher User's Guide (page 7-3) over the vlaue x.y, I tried to change the point (x.y) to a comma (x,y) and again aply to_number function over resulted value, but it doesn't work. What do I do wrong?
    I tried the solution of spliting the x from y, but I run into a problem again. The years part x has a variable length so I can't get the y part. (the substr function didn't worked with negative start position - substr(DATE, -3, 3))
    Generaly I'm a very confused about XML Publisher. There are examples in User's Guide which didn't work for me...
    If anybody has some links with documentation about XML Publisher, other than those from ORACLE, please share them with me.
    10x!

  • VEctor: Problem in arithmetical operation

    The problem with the following code is that when an element is accessed with v.elementAt() the compilation is OK. But if I try to do some arithmetic operation on the element, it won't compile, giving the message -
    VectorDemo.java:36: operator * cannot be applied to java.lang.Object, int
    System.out.println("Result: "+v.elementAt(3)*2);
    Is it because of <Object> type declaration of Vector? If so how to do arithmetic operation with an element of a vector which may have Double, Float or Integer type of elements in the same vector?
    import java.util.*;
    class VectorDemo
         public static void main(String args[])
              Vector<Object> v=new Vector<Object>(3,2);
              System.out.println("Initial size: "+v.size());
              System.out.println("Initial capacity: "+v.capacity());
              v.addElement(new Integer(1));
              v.addElement(new Integer(2));
              v.addElement(new Integer(3));
              v.addElement(new Integer(4));
              System.out.println("Capacity after four additions: "+v.capacity());
              v.addElement(new Double(5.45));
              System.out.println("Current capacity : "+v.capacity());
              v.addElement(new Double(6.08));
              v.addElement(new Integer(7));
              System.out.println("Current capacity : "+v.capacity());
              v.addElement(new Float(9.4));
              v.addElement(new Integer(10));
              System.out.println("Current capacity : "+v.capacity());
              v.addElement(new Integer(11));
              v.addElement(new Integer(12));
              System.out.println("First element : "+v.firstElement());
              System.out.println("Last element : "+v.lastElement());
              System.out.println("Find Result: "+v.elementAt(3));     //<------ if replaced with:
                                    //System.out.println("Find Result: "+v.elementAt(3)*2);
              if(v.contains(new Integer(3)))
                   System.out.println("Vector contains 3.");
              Enumeration vEnum=v.elements();
              System.out.println("\nElements in vector: ");
              while(vEnum.hasMoreElements())
                   System.out.println(vEnum.nextElement()+" ");
              System.out.println();
    }

    Here's the correct code.
    import java.util.*;
    import java.lang.Number;
    class VectorDemo
         public static void main(String args[])
              //initial size is 3, increment is 2
              String s;
              int i=0;
              Vector<Number> v=new Vector<Number>(3,2);
              System.out.println("Initial size: "+v.size());
              System.out.println("Initial capacity: "+v.capacity());
              v.addElement(new Integer(1));
              v.addElement(new Integer(2));
              v.addElement(new Integer(3));
              v.addElement(new Integer(4));
              System.out.println("Capacity after four additions: "+v.capacity());
              v.addElement(new Double(5.45));
              System.out.println("Current capacity : "+v.capacity());
              v.addElement(new Double(6.08));
              v.addElement(new Integer(7));
              System.out.println("Current capacity : "+v.capacity());
              v.addElement(new Float(9.4));
              v.addElement(new Integer(10));
              System.out.println("Current capacity : "+v.capacity());
              v.addElement(new Integer(11));
              v.addElement(new Integer(12));
              System.out.println("First element : "+v.firstElement());
              System.out.println("Last element : "+v.lastElement());
              System.out.println("Result: "+Integer.parseInt(v.elementAt(3).toString())*2);
              if(v.contains(new Integer(3)))
                   System.out.println("Vector contains 3.");
              //enumerate the elements in the vector.
              Enumeration vEnum=v.elements();
              System.out.println("\nElements in vector: ");
              while(vEnum.hasMoreElements())
                   System.out.println(vEnum.nextElement()+" ");
              System.out.println();
    }

  • Arithmetic operations using Picklist field values

    Hi,
    I tried to multiply a picklist field value as below and wanted to store the result in a field (datatype = Integer or Number) using a workflow which triggers based on the Trigger Event "Before modified record saved".
    Criticality = [<plFrequency_of_Occurrence_ITAG>] * 10
    It throws an error:
    "Update Criticality : Value too long for field 'ZNum_0' (maximum size 16). (SBL-DAT-00235)(SBL-ODS-00500)"
    Can't we do arithmetic operations on the Picklist fields? I believe this is because the values are being stored as text??
    Do we have a function to convert the character field to numeric before we perform any arithmetic operations?
    Thanks,
    Sriram

    Hi,
    You're right, you can't perform arithmetic operations with a number and a text. That's why you get the error.
    Today, there's no function you can use to convert a text to a number.
    You'll need to create a SR asking for a Change Request.
    Regards,
    Max

  • I have just upgraded to Mavericks and have been using Time Machine on an external disk with Snow Leopard.  Can I continue to backup with Time Machine on the same external disk or do I need a new disk since the operating system has changed?

    I have just upgraded to Mavericks and have been using Time Machine on an external disk with Snow Leopard.  Can I continue to backup with Time Machine on the same external disk or do I need a new disk since the operating system has changed?

    Hi there,
    I found that Time Machine in Mavericks will sort it all out for you. You shouldn't need to buy another backup drive, unless you have insufficient space left and can't afford to delete whats on there. It should just work fine.

  • Error while doing MIRO-Overflow for arithmetical operation (type P) in prog

    Hi ,
    I am getting the error while doing the MIRO  as below-
    Runtime Errors         COMPUTE_BCD_OVERFLOW
    Exception              CX_SY_ARITHMETIC_OVERFLOW
    Date and Time          20.05.2009 10:07:03
    Short text
         Overflow during the arithmetical operation (type P) in program "SAPLMRMC".
    What happened?
         Error in the ABAP Application Program
         The current ABAP program "SAPLMRMC" had to be terminated because it has
         come across a statement that unfortunately cannot be executed.
    What can you do?
         Note down which actions and inputs caused the error.
         To process the problem further, contact you SAP system
         administrator.
         Using Transaction ST22 for ABAP Dump Analysis, you can look
         at and manage termination messages, and you can also
         keep them for a long time.
    Error analysis
         An exception occurred that is explained in detail below.
         The exception, which is assigned to class 'CX_SY_ARITHMETIC_OVERFLOW', was not
          caught in
         procedure "MRM_AMOUNT_QUANTITY_PROPOSE" "(FUNCTION)", nor was it propagated by
          a RAISING clause.
         Since the caller of the procedure could not have anticipated that the
    Please let me know how can this be removed.

    Hi,
    There can be some problem with tolerances set in the customizing.
    In my case, I was getting this error because of delivery date variance. The difference between delivery date maintained in PO and invoice date was huge and hence the multiplication of price of PO and difference  of delivery date was huge and that was the reason for error.
    Similarly in your case also, there will be some tolerance limit problem.
    Please check your tolerance limits set in customizing.
    Regards,
    Mihir Popat

  • Loop to do arithmetic operations

    Hi,
    I have a 2 dimensonal array which is attached.
    Now I need to perform the following arithmetical operation on this array.
    I need to add 0 to the first row elements, 40 to the second row elements, 80 to the third row elements, 120 to the fourth row elements and so on incrementing by 40 till the last row.
    Can any one help me in building such a VI, I understand that I just need to use a for loop and keep on incrementing the addition constant by 40 but I am having trouble with this.
    I also have one more small question, is there a VI such that if I give two numbers it can generate all the numbers between them including the numbers given.
    Thanks a lot for any help in this regard.
    Ajit
    Attachments:
    1.pdf ‏25 KB

    Your second question is not quite clear. Are you talking about generating a ramp of consecutive integers?
    The attached image shows a quick solution for that.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    rampGen.gif ‏2 KB

  • Backing up Mac HD with Time Capsule AND an external hard drive

    I am sure that this question has been asked one way or another but I can't seem to find the exact answer.
    I would like to back up my Mac HD with the Time Capsule AND another hard drive essentially to create two backups. Should one fail, I still have another copy as a precaution. The Time Capsule will be my primary back up because my external hard drive is usually switched off and will only be turned on from time to time to perform "less frequent" backups.
    With Time Capsule AND the external hard drive on, will Time Machine just update the backup on the external hard drive without becoming confused with the other copy on Time Capsule? In other words, can Time Machine distinguish between two different Time Machine Backup files and bring them up to date accordingly?
    I understand there is an archive function on the Time Capsule, which would also serve the purpose. However, I am wondering if there is another way.
    Thanks.

    Rheopaipo wrote:
    I am sure that this question has been asked one way or another but I can't seem to find the exact answer.
    I would like to back up my Mac HD with the Time Capsule AND another hard drive essentially to create two backups. Should one fail, I still have another copy as a precaution. The Time Capsule will be my primary back up because my external hard drive is usually switched off and will only be turned on from time to time to perform "less frequent" backups.
    With Time Capsule AND the external hard drive on, will Time Machine just update the backup on the external hard drive without becoming confused with the other copy on Time Capsule? In other words, can Time Machine distinguish between two different Time Machine Backup files and bring them up to date accordingly?
    I understand there is an archive function on the Time Capsule, which would also serve the purpose. However, I am wondering if there is another way.
    I don't think it's possible to configure Time Machine to back up to two locations without modifying its settings frequently.
    You might consider using that external drive to hold a bootable backup. You can create such a thing with either of the utilities SuperDuper! or Carbon Copy Cloner. If you pay the registration fee for SuperDuper! (~US$28), there's a mode where it will back up only what has changed, which makes the backup operation run quicker. (Carbon Copy Cloner may offer a similar feature.)

  • A series of problems with Time Capsule

    I was an early adopter of Apple's "Time Capsule," which in theory sounds like a great idea but has been a disaster for me in practice. This is the story of my nightmare.
    In theory, Time Capsule is supposed to enable wireless, automatic backups of my hard drive via wifi. I liked the idea because I thought it would save me time and make backups so convenient that they'd be sure to happen.
    In practice, it's been slow, aggravating and buggy as ****.
    After I bought the device, I brought it home and set it up to do the initial backup of my laptop computer. My first mistake, as I learned later, was to try to do the initial backup wirelessly. The Time Capsule has an Ethernet connection that works faster than the wireless connection. (It ought to have a USB or Firewire port, which would be far faster than Ethernet, but apparently the Apple gods decided to save a nickle at the expense of quality and convenience.) It would also have been nice if the manual that came with the thing recommended using Ethernet for the initial backup, but it didn't, so I didn't discover that this was even an option until I had already wasted several days.
    Yes, days. Not hours, but days.
    I started the initial backup on a Wednesday night. My laptop's hard drive had about 130 gigabytes of files on it, and after the initial backup had run for a couple of hours, I did a calculation based on megabytes/minute and figured that it should finish up sometime that weekend. This meant that I couldn't take my laptop away from the house or turn it off, but after I'd already invested a few hours in the process, I figured I'd just let it run until completed.
    Unfortunately, the longer the backup proceeded, the slower the megabytes/minute rate became. By the following Monday morning, it was only 2/3 completed, and the copy rate had slowed to such a crawl that I had no idea when it would finish. I therefore reluctantly interrupted the process, since I had meetings to attend where I needed my computer.
    By that time, I had done some further research online and learned that people were recommending doing the initial backup via Ethernet, so when I got home that Monday night, I decided to do it that way instead of via wifi. However, it was unable to resume the interrupted backup, so I had to start over from scratch. Over the course of several attempts to do this, I discovered moreover that the interrupted backup had corrupted the disk somehow, so eventually I had no choice but to erase the Time Capsule entirely before beginning a new backup. Each of these attempts took a half hour or an hour, so I wasted my Monday evening doing nothing but try and retry to start the backup. (Somewhere in the middle of this I also did a tech support call to Apple, which also meant time on the phone, sitting on hold, etc.)
    Finally, sometime on Tuesday I got the backup started, and by late that evening I had my first incremental backup. Hooray! Or so I thought.
    The thing ran OK for a month or so, and then for no apparent reason I discovered that backups were failing. Why? No idea. I called Apple tech support again. An hour or so on hold, then talking to an operator, then trying various things. Eventually the tech support guy told me I'd have to erase the hard drive again and do a new initial backup. Great. At least I knew by then that I'd need to do it via Ethernet, but of course it took the better part of a day for the backup to run, and starting over meant losing all of the history in my previous backups. But I did it.
    After that, I had a good run for several months...maybe six months. Then, for no apparent reason, the backups started failing again. This time I managed to get the backups working again by unplugging the Time Capsule, plugging it back in, and doing some reset procedures.
    A month later, the Ethernet connection started failing.
    I have an old iMac upstairs that I plugged in to the Ethernet connection so it can access the internet and file-share with my laptop. One day I noticed that the iMac's internet connection was no longer working. After some testing, it turned out that neither the iMac nor my laptop is able to connect anymore through the Ethernet connection. I tried several cables, tried playing around with settings, to no avail. I had a trip to Hong Kong coming up, so I decided I'd worry about the Ethernet connection after I got home.
    On the Saturday before my Monday morning flight to Hong Kong, my laptop died.
    It was working fine on Friday evening. I went to bed, got up, and the screen was black. In a panic, I drove to the Apple store and, after much pleading, got them to look at the thing in a hurry. Their tests showed that the logic board was bad. Fortunately, they had a replacement in stock, so they were actually able to repair the laptop in only two hours.
    Since then, however, I haven't been able to get backups to work at all on my Time Capsule.
    When the laptop died, I figured I might need to restore files from the Time Capsule, so I unplugged it and took it with me on my frantic drive to the Apple Store. After I brought it home and plugged it back in, the laptop recognizes that it exists, but instead of doing an imcremental backup, Time Machine wants to start all over with a backup of more than 140 gigabytes.
    No ******* way.
    My plan at this point is to make an appointment at the Apple Store and take it in to someone at their Genius Bar. Maybe they can figure out why Ethernet isn't working and why the incremental backups aren't happening. In the meantime, I don't know if any of the backups that it has done to date are any good, so it's an uneasy feeling. And, of course, I've wasted more time than I care to think about just tweaking and nursing the thing.
    It just isn't worth it.
    If anyone has any suggestions for what I should be trying at this point, I'd love to hear advice.

    I've got some time here as I wait on my computer (more on that in a moment), so in the meantime I re-read Smokerz's reply to my message. Upon re-reading, I thought I'd respond again.
    Smokerz is saying basically that Time Capsule is great for purposes OTHER than backing up my computer's hard drive: "Make your primary TM backup using an external FW800 drive first. ... I don't do TM on TC but use TC as my internet file server for my family who all lives far from one another and stream movies to my ATV. Much better use of TC, eh?"
    There might be a case for that use of Time Capsule, but the product is advertised and sold primarily as a wireless backup device. The main page for the product on apple.com describes it as "Automatic wireless backup for your Mac. ... Time Capsule is a revolutionary backup device that works wirelessly with Time Machine in Mac OS X Leopard. It automatically backs up everything, so you no longer have to worry about losing your digital life."
    Smokerz is therefore arguing that I should be happy with a product that doesn't work for the purpose for which it is primarily advertised and for which I bought it. I don't have any use for it as an internet file server or to stream movies. To say I should be happy with it for those purposes makes no sense.
    Here's a little update on my experience with this thing. I made an appointment and visited the Genius Bar at the Apple Store yesterday. My appointment was at 10:40. I spoke with *** ****, who by the way is "Lead Genius" at the West Towne story in Madison, WI. I've got no problems with him. Like every other Apple employee I've dealt with locally, he was competent, courteous and and helpful. He quickly fixed my Ethernet problem, but the more important problem -- the failure to connect to my existing backups -- left him stumped as it did me. The problem apparently is that when Time Machine uses the MAC address of your computer's logic board as part of its way of identifying your system. There is a file on the backup drive that stores this information. It's filename consists of a period followed by the old MAC address. There is a procedure for renaming that file and changing some other settings which is supposed to make the backup work again. The procedure is detailed here:
    http://www.macosxhints.com/article.php?story=20080128003716101
    http://discussions.apple.com/thread.jspa?messageID=6893237
    The problem in my case is that the file was missing when I went looking for it. (I hadn't been mucking around on my Time Capsule, so I don't see any way that I could possibly have deleted it.)
    After some scratching his head, *** asked me to leave my computer and Time Capsule with him at the Apple Store and come back at 2:30 that afternoon. When I returned, not much progress had been made. He had found a way to make Time Machine do another initial backup from scratch within the same sparsebundle as my older backups and thought that once that backup completed, there would be a way to connect up with the the older backups. By 2:30, however, the backup had only completed 4 GB out of the 130 gigs on my hard drive. The Apple Store closes at 9 p.m., so I would have had to leave it with them overnight just to get through that stage of the process. I think I mentioned previously that I live an hour's drive from the Apple Store, and since I had already burned another entire day trying to get this thing working, I had *** give it back to me so I could take it home and try to complete the procedure myself.
    Once I got it home, I let the backup run overnight. It took about 12 hours to complete. Now I'm going through the procedure *** gave me, which is documented in a little more detail here on Sean Kelly's blog:
    http://seankelly.tv/blog/blogentry.2008-08-25.8041499927
    I just finished spending an hour waiting for the computer to open my sparsebundle (step three of Sean Kelly's procedure). Only six more steps to go!
    <Edited by Moderator>

  • Is it possible to configure Time Capsule to work with Time Machine (MBP) and Genie Timeline (PC)

    I have an Apple Time Capsule (2TB) and I need to configure it to work with my MBP and Time Machine and also back up my a PC with Genie Timeline Pro 2013 (or any other suggested PC back up software).
    Setting it up to work with Time Machine is simple enough but the PC access is proving to be difficult.
    http://www.genie9.com/support/KB/KnowledgeArticle.aspx?KBID=198
    I followed the above steps but still can't connect to the network drive.  I have reformatted the TC and will be walking through the steps again.  My concern is that the two different operating systems (Win8 and Mavericks) can't share the same destination drive.
    I have created two user accounts with drive sharing activated.  One in my name for my MBP and the other in the name of my partner for her Dell laptop.
    Should the Time Capsule be partitioned?  Can it even be partitioned?  When I use Drive Utility it can't see the TC.  The only way to connect to it seems to be via Airport Utility.
    On a seperate note the TC Router Mode is set to OFF (Bridge Mode).  I have connected it to the ADSL modem/router (WiFi Off) via the WAN port.  All seems to be well.  Am I loosing any useful functionality by doing this?
    The internet settings are set Connect Using DHCP.  I have no issues but I am not really sure what it means and if I should be using other settings.  The ADSL modem/router seems to have all the PPP0E settings.
    The WiFi on the TC has been set up with a 5Ghz and 2.4Ghz network as well as a Guest Network.  I then plan to introduce 2 Airport Express (MB321LL/A). One will be an access point for AirPlay and the other a wireless extender with AirPlay.
    There is also a Canon WiFi printer that accesses the 2.4Ghz network.  It has an Ethanet port so I am wondering if I should disable the wifi connection and cable it and if so to the TC or the DSL modem/router.

    Lion, 7.6.1 firmware and iCloud offers remote access.
    http://www.apple.com/au/support/icloud/back-to-my-mac/
    To do it without the iCloud service your issue is static public IP address.. if you have one this is simple to the point of trivial. If not it is very hard, as Apple did not put in a standard dynamic DNS service.. (ensuring you were roped into their cloud accounts). Static IP from your ISP is the best solution.. if it is possible go for it.
    Then the actual protocol for access is AFP, so the only device you can do this on is a Mac.
    Do you have the TC as the main router?
    If you want any other kind of access, or to avoid icloud use vpn.. which teamviewer is a kind of.. but buy a real vpn router, and bridge the TC.. you can then vpn into your network with full security and get windows access via smb..

  • ODBC BI Server Bug - arithmetic operation resulted in an overflow

    I am trying to write some really simple .NET code access the Oracle BI Server ODBC driver and it's not working at all.  I've connected fine, however it seems like anything I try to do related to getting database information spits up an error "arithmetic operation resulted in an overflow".
    Here is the code:
    Dim ConnectString As String
    Dim FactoryType As String
    Dim Factory As System.Data.Common.DbProviderFactory
    Dim Connection As System.Data.Common.DbConnection = Nothing
    Dim TablesData As System.Data.DataTable = Nothing
    Dim err As String = ""
    Dim nl As String = Chr(13) + Chr(10)
    Try
        ' Connect to the database via ODBC
        ConnectString = "DSN=BSODBC_7;uid=TheUser10;pwd=************"
        FactoryType = "System.Data.Odbc"
        Factory = System.Data.Common.DbProviderFactories.GetFactory(FactoryType)
        Connection = Factory.CreateConnection
        Connection.ConnectionString = ConnectString
        Connection.Open()
        ' Request a list of tables from the database
        ' ** Tried both with restrictions and without
        ' ERROR on this line:
        ' “Arithmetic operation resulted in an overflow.”
        TablesData = Connection.GetSchema("Tables")
        ' Show the list of tables on the screen in a grid
        ' If it was successful.
        OnScreenGrid.AutoGenerateColumns = True
        OnScreenGrid.DataSource = TablesData
    Catch ex As Exception
        ' Report the error
        err = ex.Message
        If Not (ex.InnerException Is Nothing) Then
            If Not (ex.InnerException.Message Is Nothing) Then
                err = err + nl + nl + ex.InnerException.Message
            End If
        End If
        MsgBox(err, MsgBoxStyle.OkOnly + MsgBoxStyle.Exclamation, "Error")
    Finally
        ' Clean up and Close the DB Connection
        If Not (Connection Is Nothing) Then
            Connection.Close()
            Connection.Dispose()
            Connection = Nothing
        End If
    End Try
    Any Thoughts?  Is this a known bug?  Is there a fix?

    I doubt on line
    OnScreenGrid.DataSource = TablesData
    instead of array as TablesData try to take List object and assign it to OnScreenGrid.DataSource
    just in case check this
    DataGridView.AutoGenerateColumns Property (System.Windows.Forms)
    I might be wrong but just check it

  • Overflow for arithmetical operation (type P) in program.

    Hi experts..
    I had developed a report for showing total receipt and issues and confirmed issue.
    of PQ.
    For all the plant is running fine but only for one plant 2050 its going into dump and error is "Overflow for arithmetical operation (type P) in program." and the code line is
    T_EKET-MNG02 = T_EKET-MNG02 * ( t_mdbs-umrez / t_mdbs-umren ).
    MNG02 IS OF TYPE  Data : "Quan", length =13 , decimal = 3.
    initially : value in Mng02 is =  10       and ratio is 11/8 = 1.375
                  and in the debugging the value is   10*1.375 = 13.75
    but... when i am executing it .. its going into dump and after again checking the MNG02 is showing valude --9765133613.881  and the above error.
    what should i do....
    please help..
    i will award the points for every help...
    thanks

    Hi,
    Are you doing any other calculation for field MNG02 in your program?
    I created a small program with the field and values you have mentioned and it gave me the result 13.75 and no short dump.
    Please check following things:
    When short dump occurs, it shows at which line it has occured. Is it showing that the shortdump has occurs on the line you are talking about here or it is somewhere else.
    Also, when shortdump occurs, it shows a "debugging" button at the top. Hit that button and it will show you exactly where the short dump has occured. What ever this statement is, check what are the values of different variables here.
    Check all these and you might get the answer. Let me know if you still have problem.
    Regards,
    RS

  • Power query from ODBC :"DataSource.Error: Arithmetic operation resulted in an overflow"

    Good day
    Everytime I want to pull data into a query from our servers it gives the error "DataSource.Error: Arithmetic operation resulted in an overflow". What is the reason for this error, and how do I get past this bump.
    Thanks in advance
    Arnoux

    Hey Tristan. Thanks I did that yes.
    For some reason my direct MySQL connection does not want to work.
    I get the following error
    DataSource.Error: MySQL: Unable to find a database provider with invariant name 'MySql.Data.MySqlClient'.
    This error may have been the result of provider-specific client software being required but missing on this computer.  To download client software for this provider, visit the following site and choose at minimum 'MySQL Connector/Net':

Maybe you are looking for

  • SD tax G/L account determination

    First, I am not a Finance person nor do I know a lot about tax configuration.  My background (relevant for this issue) is in S/D pricing and associated account determination.  This is an S/D tax calculation and account determination issue for the Uni

  • How can I restore my iphone when Its disabled and itunes wont connect to it?

    My phone is disabled and when i pulg it in it wont come up on itunes and i dont have "find my iphone" how can i restore it??

  • How to install 32bit Premiere Element 10 on 64bit Windows7?

    Premiere Elements 10 comes with 32bit and 64bit programs.  The 2 versions each use different codecs.  My camera manufacturer only supplies 32bit codecs, so the 64bit Premiere Elements 10 program cannot work with my camera's video files.  The 32bit pr

  • Ipad was stolen and no longer in icloud

    My ipad was previously in Icloud and had been for years. It was stolen yesterday and now when I try to track it It is no longer listed as a device in Icloud. What can I do?

  • "Video Bandwidth Unavailable" on 7960 phone with video

    We have severla sites using video on workstations and Cisco 7960 phoens. It is working. Recently one branch stopped working with "Videio Bandwifht Unavailable" on the phones when trying to connect. Qos settings have not changed since it was working a