posted 18 years ago
I know we can cast like following
"
select cast(name as varchar) from Master..sysdatabases
"
and it works ,but I am getting the query from the user in a textarea.
So I cannot dynamically do it.
An alternative I found is
......
Statement stmt = connection.createStatement();
ResultSet rs= stmt.executeQuery("SELECT * FROM emp_table");
if(rs.next()) {
java.sql.Struct empType = (java.sql.Struct)rs.getObject(1);
System.out.println("Number of attributes "+ empType.getAttributes().length);
System.out.println("Name is " + empType.getAttributes()[0]);
System.out.println("Designation is " + empType.getAttributes()[1]);
System.out.println("Department is " + empType.getAttributes()[2]);
}
stmt.close();
......
But it cannot be implemented in TableModel, So pls someone help me.
Ram Mohan