• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

where's the problem.....

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
How to display characters like square root etc
('u221A' unicode char) dynamically in JtextArea after
accessing it from MS Access.

In this if i explicitly settext like i have done is ie ta.setText("\u221A") it gives the result properly i mean it shows me the square root sign...... but when i get this data dynamically from resultset it doesnt work, it shows the data in textarea as \u221A not as the square root sign....
here is the code....
Pls help me .......
import java.sql.*;
import java.applet.*;
import javax.swing.*;

public class fetchFromDBtest extends JFrame
{
public static void main(String args[])
{
fetchFromDBtest fetch=new fetchFromDBtest();
}
public fetchFromDBtest()
{
QuestionDatabase();
}
public void QuestionDatabase()
{
Statement stmt; // SQL statement
String query; // SQL select
ResultSet rs; // SQL query results
boolean more = false; // "more
Connection DBConn=null;
// ODBC data source name
String dsn = "jdbc dbc:test";
String val=" " ;
JFrame f=new JFrame();
f.setTitle("test");
f.setBounds(100,100,400,400);
JTextArea ta=new JTextArea();
ta.setBounds(110,110,100,50);
try{
Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
}catch(ClassNotFoundException ee) {
ee.printStackTrace();
}
// Connect to the database
try{
DBConn = DriverManager.getConnection(dsn);
// Shut off auto-commit
//DBConn.setAutoCommit(false);
}catch(SQLException se){
System.out.println("SQLException" + se);
}
query = "SELECT * FROM Question";
try{
stmt = DBConn.createStatement();
rs = stmt.executeQuery(query);
// Check to see if any rows were read
more = rs.next();
if (!more) {
System.out.println("No rows found.");
return;
}
// Loop through the rows retrieved from
int loop = 0;
loop:
while (more) {
loop++;
val= rs.getString("question");
more = rs.next();
if (!more) {
break loop;
}
}
ta.setText("\u221A : "+val); //only the last record will be set as text
ta.setVisible(true);
f.getContentPane().add(ta);
f.setVisible(true);
rs.close();
stmt.close();
}catch (SQLException se){
System.out.println("SQLException " + se);
}
}
}
 
reply
    Bookmark Topic Watch Topic
  • New Topic