on 01-31-2008 8:54 AM
Hello @ all
I want to download the content of database table to an excel file.
The connection to the database and the selection of the data is not the problem. But writing the ResultSet to an excel file is the problem.
the scenario is: the user clicks on a FileDownload-uiElement and then the application gets the data from the database and the user can store the file on his local filesystem (e.g. c:\template.xls)
I hope you can help me.
Thanks a lot.
hi
Can you please let us know the solution...
regards,
Sushil Jain
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your efforts.
I'm a fool, i solved it on my own already.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I know that I can use POI, but the FileDownload-UIElement which I want to use, needs an attribute of type Resource.
my current code looks like this (will be executed by a method called in wdDoInit):
ResultSet resultS = null;
DataSource dataSource = getDataSource();
if (dataSource != null)
{
connect = dataSource.getConnection();
if (connect != null)
{
stateM = connect.createStatement();
resultS = stateM.executeQuery("SELECT * FROM mytable);
ResultSetMetaData rsMD = resultS.getMetaData();
int col = rsMD.getColumnCount();
IWDResource res = null;
while (resultS.next())
{
String content = resultS.getString(2);
byte[] b = content.getBytes();
res = WDResourceFactory.createCachedResource(b, MainTransDatView.FILE_NAME, WDWebResourceType.XLS);
}
wdContext.currentResourceNodeElement().setResource(res);
}
}
Edited by: Claudia Sass on Jan 31, 2008 10:09 AM
Hi,
This article might of use for you
Regards
Ayyapparaj
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.