Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

how to concatinate 3 values in a textfied from resultset

$
0
0
I am trying to concatinate 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 its useless can i please get some suggestions

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>