formating database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • najmi
    New Member
    • Sep 2007
    • 46

    formating database

    hai guys...do you know how to formating the currency data from database into java form
  • sukatoa
    Contributor
    • Nov 2007
    • 539

    #2
    Originally posted by najmi
    hai guys...do you know how to formating the currency data from database into java form
    I dont know, but if i like to learn from it, i should look first to Google's friend...

    regards,
    sukatoa

    Comment

    • najmi
      New Member
      • Sep 2007
      • 46

      #3
      thans 4 ur sugestion,but i need it as soon as posible,,

      Comment

      • JosAH
        Recognized Expert MVP
        • Mar 2007
        • 11453

        #4
        Originally posted by najmi
        thans 4 ur sugestion,but i need it as soon as posible,,
        Feeding "currency format Java" to Google would've been faster than typing another
        response in here. If might even give you spoonfeeding code which you're not going
        to find here.

        kind regards,

        Jos

        Comment

        • r035198x
          MVP
          • Sep 2006
          • 13225

          #5
          Originally posted by najmi
          ... formating the currency data from database into java form
          I don't understand the "into java form part".

          Comment

          • BigDaddyLH
            Recognized Expert Top Contributor
            • Dec 2007
            • 1216

            #6
            Originally posted by r035198x
            I don't understand the "into java form part".
            Yes the original question is vague and I suspect has nothing, really, to do with a database. Try to rephrase the question by being clearer. For example:

            I have a date:

            java.sql.Date date = ..

            but I would like to format it as a string in the following format:

            2008-03-30 22:30:57

            using time zone UTC.


            See? It's not that hard to be coherent.

            Comment

            • najmi
              New Member
              • Sep 2007
              • 46

              #7
              ok..
              let say i have enter into the ms access database $200.00..
              for your information, i already format the decimal point into 2 in db.
              so when i call back into java form it come out with this value $200.0000

              Comment

              • BigDaddyLH
                Recognized Expert Top Contributor
                • Dec 2007
                • 1216

                #8
                Originally posted by najmi
                ok..
                let say i have enter into the ms access database $200.00..
                for your information, i already format the decimal point into 2 in db.
                so when i call back into java form it come out with this value $200.0000
                Note that 200.00 == 200.0000, the only difference being the number of decimal places displayed.

                How can one control the number of decimal places displayed? There are several classes that can do this, including:

                java.text.Decim alFormat: http://java.sun.com/javase/6/docs/ap...malFormat.html
                java.util.Forma tter: http://java.sun.com/javase/6/docs/ap...Formatter.html
                and the format methods of PrintWriter, PrintStream and String: format method API

                Comment

                • najmi
                  New Member
                  • Sep 2007
                  • 46

                  #9
                  can anybody help me how to generate auto id or number

                  Comment

                  • BigDaddyLH
                    Recognized Expert Top Contributor
                    • Dec 2007
                    • 1216

                    #10
                    Originally posted by najmi
                    can anybody help me how to generate auto id or number
                    The precise SQL used to get back a generated sequence number varies from database vendor to database vendor. (So much for JDBC and vendor independence!)

                    There is also some support for doing this in the JDBC API:

                    int executeUpdate(S tring sql, boolean autoGeneratedKe ys)
                    ResultSet getGeneratedKey s()

                    I haven't used these because as soon as I could, I moved up from JDBC to Hibernate, and haven't looked back.

                    Comment

                    Working...