Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9074625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T18:40:53+00:00 2026-06-16T18:40:53+00:00

I am trying to concatenate 3 resultset values from my database and display them

  • 0

I am trying to concatenate 3 resultset values from my database and display them together in one textfield but its not working i am getting only last value that is “city” displayed in textbox.

PreparedStatement stmt2 = con.prepareStatement("select  bk_name as bank,bk_branch as branch,bk_add as city from bk_det WHERE rm_id = ?");
ResultSet rs2;
String rm2 = tf_rmid.getText().trim();
stmt2.setInt(1, Integer.parseInt(rm2));
rs2 = stmt2.executeQuery();
while (rs2.next()) {
    tf_remby.setText(rs2.getString("bank"));
    tf_remby.setText(rs2.getString("branch"));
    tf_remby.setText(rs2.getString("city"));
}

I tried doing:

tf_remby.setText(rs2.getString("bank"+","+"branch"+","+"city"));

and also

tf_remby.setText(rs2.getString("bank"+"branch"+"city"));

but neither works. Does anyone have any suggestions/solutions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T18:40:54+00:00Added an answer on June 16, 2026 at 6:40 pm

    In your while loop, you could try something like:

    String text = rs2.getString("bank") + ", " +
                  rs2.getString("branch") + ", " +
                  rs2.getString("city");
    tf_remby.setText(text);
    

    But if you have multiple values in the result set, you’ll only see the last bank/branch/city record anyway.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to concatenate two fields from a list to display in a
i'm trying to concatenate several columns from a persistent table into one column of
I am using SSMS 2008 and trying to concatenate one of the rows together
I am trying to concatenate and display string and number together in a table
I'm trying to concatenate 3 [char(32)] fields: title1 title2 title3 into one field, but
I'm trying to concatenate two properties into one string like so: public class thing
I am trying to concatenate image url (string) with img tag but i am
im trying to concatenate 3 columns in a select query to show in one
I am trying to concatenate the select statment results in one row. For eg
I am trying to concatenate the output of various functions into a textbox, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.