Link to home
Start Free TrialLog in
Avatar of smartvanl5
smartvanl5

asked on

Saving QueryDataSet Result to the File ....

I am trying to save QueryDataSet result to file, by reading data column by column and row by row, but as I do not know the data type of column how to save data to the file.

Thanks & Regards,
Avatar of RuadRauFlessa
RuadRauFlessa

Try retrieving the Metadata of the data set if there is any.
Avatar of smartvanl5

ASKER

How to get the DataType of the Column.
Avatar of TimYates
I still unable to solve my problem, As I am new in JAVA.

I am requesting you Send me code which SAVE QueryDataSet result in the file.

Please ...
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
> I am requesting you Send me code which SAVE QueryDataSet result in the file.

What code do you have already?  Any of it?
   try {
      QueryDataSet DashBoard = new QueryDataSet();
      WorkbookSettings ws = new WorkbookSettings();
      ws.setLocale(new Locale("en", "EN"));
      workbook = Workbook.createWorkbook(new File("c:/igmoutput/query.xls"), ws);
      WritableSheet sheet = workbook.createSheet("Result", 0);
      //Label label = new Label(Column, Row, "A lable record");
      int iCurrentColumn = 0;
      int iCurrentRow = 0;
      while (DashBoard.columnCount() > iCurrentColumn) {
        Label label = new Label(iCurrentColumn, iCurrentRow, DashBoard.getString(0));
        sheet.addCell(label);
        iCurrentColumn = iCurrentColumn + 1;
      }
      iCurrentRow = iCurrentRow + 1;
      while (DashBoard.inBounds()) {
        iCurrentColumn = 0;
        while (DashBoard.columnCount() > iCurrentColumn) {
          Label label = new Label(iCurrentColumn, iCurrentRow, DashBoard.getString(0));
          sheet.addCell(label);
          iCurrentColumn = iCurrentColumn + 1;
        }
        DashBoard.next();
        iCurrentRow = iCurrentRow + 1;
      }
      workbook.write();
      workbook.close();
    } catch (Throwable t) {
      System.out.println(t.toString());
      t.printStackTrace();
    }


Label label = new Label(iCurrentColumn, iCurrentRow, DashBoard.getString(0));

As I am getting the column data, I do not know column data type.

smartvanl5, do you see what's happened here? Everyone has assumed you're talking about the Java API, but you're not - you're talking about some proprietary API. Unless you have a very good reason for using this, it would be better if you don't, as you'll find it much easier to get support and your code will be much more portable (as well as your accumulated knowledge).

I haven't even been able to find the docs online for QueryDataSet.
Sorry for inconviance,

I am using JBuilder8 for development so QueryDataSet is part of it.
Well, the question can probably only be answered by fellow JBuilder users then i'm afraid since the docs for that class don't seem to be publicly available
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Despite the fact this is not a normal ResultSet, my earlier comment about it not being necessary to know the type will probably still hold
Yeah, it does :-)  (I think)...  you can call "getObject", but I have no way of knowing what the response is, as I have never used this class in my life...  I'm a JDBC man myself ;-)