Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: how to get a data from database and store it in a variable?

  1. #1
    Junior Member
    Join Date
    Dec 2012
    Posts
    12
    My Mood
    Confused
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default how to get a data from database and store it in a variable?

    can you please teach a code on how to get a certain data from the access data base and store it in a variable in java?


  2. #2
    Super Moderator curmudgeon's Avatar
    Join Date
    Aug 2012
    Posts
    1,130
    My Mood
    Cynical
    Thanks
    64
    Thanked 140 Times in 135 Posts

    Default Re: how to get a data from database and store it in a variable?

    Quote Originally Posted by jabaman View Post
    can you please teach a code on how to get a certain data from the access data base and store it in a variable in java?
    Your question is extremely broad, and is in effect asking us to re-write full tutorials that have already been written. Rather than do that, why not Google for a tutorial on this, and try what the tutorial suggests? Then if you get stuck you can come back with a specific and answerable question about problems you are having.

    Or if you've already gone through the tutorials and have a problem with your code, then please show us your code and ask a more specific question.

  3. #3
    Junior Member
    Join Date
    Dec 2012
    Posts
    12
    My Mood
    Confused
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: how to get a data from database and store it in a variable?

    i want to display first the amount money that is stored in my database but i dont know how should i match it with the user that owns that amount in my database
    can you give help me on that?
    and this code dont gave me the output
       b1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                   try{ 
                    t1.setText(rs.getString("money"));
                   }
                   catch(Exception ex){}
     
                }
            });

  4. #4
    Super Moderator curmudgeon's Avatar
    Join Date
    Aug 2012
    Posts
    1,130
    My Mood
    Cynical
    Thanks
    64
    Thanked 140 Times in 135 Posts

    Default Re: how to get a data from database and store it in a variable?

    Your question is too vague and missing too much information for me to be able to help you. Please consider that we have no clue as to what your program looks like or any aspect of your problem other than what you choose to show us. Put yourself in our shoes as you're formulating your question and ask yourself what information we'll need to fully understand your problem. Then please report back with more information that can help us help you. Luck.

  5. #5
    Junior Member
    Join Date
    Dec 2012
    Posts
    12
    My Mood
    Confused
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: how to get a data from database and store it in a variable?

    sorry if my question is to vague. my knowledge in java is too narrow, iam planning to create a javabank base on my existing database. and ive just started my program. and now i am stuck on.my problem is that for example if i login in the system how can i retrieve the amount of money in that username.

Similar Threads

  1. How can i store time in a variable for comparsion?
    By steven_bishop in forum Java Theory & Questions
    Replies: 3
    Last Post: December 2nd, 2012, 01:45 PM
  2. How to store char variable in an array
    By ashboi in forum Java Theory & Questions
    Replies: 1
    Last Post: November 9th, 2012, 12:48 PM
  3. array to store multiple names and data
    By u-will-neva-no in forum Java Theory & Questions
    Replies: 2
    Last Post: May 6th, 2011, 05:03 AM
  4. Replies: 2
    Last Post: January 21st, 2011, 02:07 AM
  5. How can i store ArrayList objects in Access database
    By frankycool in forum JDBC & Databases
    Replies: 0
    Last Post: November 4th, 2009, 12:44 AM