Update is not working......... |
rama |
2007-10-02 06:00:10 |
Hi All,
i am updating excel file using update statement.the query executed fine but the excel file is not updated.here i am attaching the code.
Class.forName("com.hxtt.sql.excel.ExcelDriver").newInstance();
Workbook workbook1 = new Workbook();
workbook1.open("e:\\reportadd.xls");
String url="jdbc:excel:////"+"e:\\reportadd.xls";
con = DriverManager.getConnection(url, "", "");
stmnt = con.createStatement();
String query = " update sheet1 set Status=1 where TrackId='"+tid+"' and Publisher='"+pub+"' ";
int i = stmnt.executeUpdate( query );
stmnt.close();
con.close();
statement is executing but the changes are not updated in the excel file.
please help me to solve the problem.
regards,
Rama.
|
Re:Update is not working......... |
HXTT Support |
2007-10-02 07:42:58 |
>int i = stmnt.executeUpdate( query );
You should print i value, if i>0, there shoud be i updated rows.
|
Re:Re:Update is not working......... |
Rama |
2007-10-02 21:04:07 |
Hi all,
Thanks for your response. I printed i value i am getting i value greater than 0(that is 1) but even one row is also not updating. please help me how i can resolve it.
Thnaks in advance.
Regards,
Rama.
|
Re:Re:Re:Update is not working......... |
HXTT Support |
2007-10-02 23:12:19 |
>Workbook workbook1 = new Workbook();
>workbook1.open("e:\\reportadd.xls");
What're these code?
|
Re:Re:Re:Re:Update is not working......... |
rama |
2007-10-03 01:33:10 |
hi all,
Thanks for your response. This code is to open an excel file.I am updating the column of that file(e:\\reportadd.xls")
thanks in advance.
Regards,
Rama
|
Re:Re:Re:Re:Re:Update is not working......... |
HXTT Support |
2007-10-03 02:26:24 |
>but the excel file is not updated.
How can you know that excel file hasn't been updated. Your Workbook shouldn't see those modifications. If you query through HXTT Excel JDBC driver again, you can see those modifications. If you wish to see those modifications at once after close connection, you need to set delayedClose=-1 connection property.
|
Re:Re:Re:Re:Re:Re:Update is not working......... |
Rama |
2007-10-03 22:39:46 |
HI ALL,
Thanks for your response.please help me how i can set that property delayedClose=-1. I have seen the connection class there is no such property available. please help me how i can do this.
Thanks in advance.
Regards,
Rama
|
Re:Re:Re:Re:Re:Re:Re:Update is not working......... |
HXTT Support |
2007-10-04 04:37:25 |
1st method:
String url="jdbc:excel:////"+"e:\\reportadd.xls?delayedClose=-1 ";
con = DriverManager.getConnection(url, "", "");
2nd method:
String url="jdbc:excel:////"+"e:\\reportadd.xls";
Properties properties=new Properties();
properties.setProperty("delayedClose","-1");
con = DriverManager.getConnection(url, properties);
|