wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes where's the problem..... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "where Watch "where New topic
Author

where's the problem.....

harpreet singh
Greenhorn

Joined: Nov 08, 2001
Posts: 2
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);
}
}
}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: where's the problem.....
 
Similar Threads
Insert Problem ! Please Help !
SQL commands in MS-Access....Pls Help
Accessing a Microsoft Access Database
JdbcOdbc Connection
URL error (DSN not found)