Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Swing-AWT Query on StringTokenizer
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


raja
Query on StringTokenizer
1 Answer(s)      4 years ago
Posted in : Swing AWT


Sir,I kept my some data in backend using ms-access. for Example my data is like this vijayawada is good city.india is my country.i am raja.

when i retrieve this data from backend and keep it in a String .i want to add this String in JLabel like this JLabel o=new JLabel(st); My question is want to display the above data in this format

vijayawada is good city. india is my country. i am raja.


Advertisement
View Answers

December 7, 2010 at 5:35 PM


Hi Friend,

Hope that the given code will be helpful for you.

import java.sql.*;
import javax.swing.*;
class RetrieveData{
    public static void main(String[] args){
        try{
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
           Connection con = DriverManager.getConnection("jdbc:odbc:student");
           Statement st=con.createStatement();
           ResultSet rs=st.executeQuery("select * from data where id=1");
           String str="";
           while(rs.next()){
              str=rs.getString("message");
           }
           JFrame f=new JFrame();
           f.setLayout(null);
           JLabel l=new JLabel(str);
           l.setBounds(10,10,300,20);
           f.add(l);
           f.setVisible(true);
           f.setSize(350,100);
        }
        catch(Exception e){
        }
    }
}

Thanks



Related Tutorials/Questions & Answers:
Query on StringTokenizer
Query on StringTokenizer   Sir,I kept my some data in backend using ms-access. for Example my data is like this vijayawada is good city.india is my country.i am raja. when i retrieve this data from backend and keep
Java stringtokenizer
Java stringtokenizer  What is difference between string and stringtokenizer
Advertisements
Problems in Stringtokenizer
node[]; StringTokenizer str,str1; Input() throws Exception { FileReader df=new FileReader("Input.txt"); Scanner fr=new Scanner(df); str=new StringTokenizer... StringTokenizer(fr.nextLine(),"$"); System.out.println("rtryutrty"+n+vn); for(int i
Problems in Stringtokenizer
node[]; StringTokenizer str,str1; Input() throws Exception { FileReader df=new FileReader("Input.txt"); Scanner fr=new Scanner(df); str=new StringTokenizer... StringTokenizer(fr.nextLine(),"$"); System.out.println("rtryutrty"+n+vn); for(int i
Problems in Stringtokenizer
node[]; StringTokenizer str,str1; Input() throws Exception { FileReader df=new FileReader("Input.txt"); Scanner fr=new Scanner(df); str=new StringTokenizer... StringTokenizer(fr.nextLine(),"$"); System.out.println("rtryutrty"+n+vn); for(int i
program using StringTokenizer
program using StringTokenizer  I want to know about StringTokenizer,so can you please explain it with an example
StringTokenizer not returning proper result
StringTokenizer not returning proper result  I have this code... System.out.print("Enter the stack integers side by side with a space in between: "); StringTokenizer st=new StringTokenizer(br.readLine()); int a[]=new int[9000
Can iadd StringTokenizer into JLabel componenet
Can iadd StringTokenizer into JLabel componenet  l24="india.cricket.java.dotnet.oracle" String mn=l24; StringTokenizer mn1=new StringTokenizer(l24...(3,280,1580,600); nowon.setBackground(Color.cyan); sir i want to add StringTokenizer
how to use stringtokenizer on table? and display in table format.
display result in row format  how to use stringtokenizer on table? and display in table format
how to use stringtokenizer on table? and display in table format.
how to use stringtokenizer on table? and display in table format.  table is retrieved from mysql database and each row contains data like(java,c,c++,.net
Breaking a string into words without using StringTokenizer
Breaking a string into words without using StringTokenizer  how can we Break a string into words without using StringTokenizer ??   The given code convert the string into words. import java.util.*; class StringExample
how to use StringTokenizer to retrieve the class name, attributes name and methods name from the Java Source Code
how to use StringTokenizer to retrieve the class name, attributes name and methods name from the Java Source Code  hi, I have done a program whereby... { StringTokenizer st = new StringTokenizer( line, "; " ); while
query in JDBC
query in JDBC  What are the steps required to execute a query in JDBC
query string
query string  Need some examples of query strings.send me as soon as possible. Regards, R.Santhosh
query optimization
query optimization  hai ! i need a code in java for database query optimization.plz help
Query Question
Query Question  How would I write a query to display the name, department of the employee that earns the highest salary in the Employees table
HQL Query
HQL Query  Hibernate query language: How to use a left join in Hibernate query language. Can somebody help with an example. I am getting a unexpected token error in HQL Query tool If I use joins
jdbc query
jdbc query  write a query of how to print the values of any column present in database in reverse order
Sql Query
Sql Query  Is this query work in Db2 or not ? Select * from FORUM LIMIT 2
Sql Query
Sql Query  Is this query work in Db2 or not ? Select * from FORUM LIMIT 2
database Query
database Query  i have to find common columns from two tables from 2 different schemas what query to use? i used intersect but i am not getting how it is comparing two tables from different schema because in query we have
database Query
database Query  i have to find common columns from two tables fron 2 differnt schemas what query to use? i used intersect but i am not getting how it is comapring two tables from different schema because in query we have
sql query
sql query  two tables are emp,loc write a query to display all the emp information whose locname not equal to bangalore
session into a query
session into a query  Hi all this am Sreedhar from Hyderabad i am calling one session variable in mysql query but its not working can any one help me please... here is the query.. $query = 'SELECT * FROM post WHERE post_date <
query problem
query problem  how write query in jsp based on mysql table field? i have employee table it contain designation field, how write query in jsp... to write this query in jsp please anybody help me, and send me that code
SQL Query
SQL Query  Selecting the third highest salary of Employee without using any subquery?   Here is a query: SELECT salary FROM employee ORDER BY salary DESC LIMIT 2,1
HQL query
HQL query  how to select only password based on username using HQL query from login table where uname and paswrd are two column names
Advertisements
 

 

 

DMCA.com