简体   繁体   English

如何在Java中的Sqlite中更新ResultSet

[英]How to update ResultSet in Sqlite in Java

I want to update my ResultSet with using SQLite in Java. 我想在Java中使用SQLite更新我的ResultSet。 When i am trying to update the Resultset it is giving me an exception : java.sql.SQLException: not implemented by SQLite JDBC driver . 当我尝试更新结果集时,它给我一个异常: java.sql.SQLException: not implemented by SQLite JDBC driver i have also done : 我也做了:

stmt = c.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);

but still getting the exception, i think it is because we cannot update the result Set using SQLite DB. 但仍然出现异常,我认为这是因为我们无法使用SQLite DB更新结果集。 Please help that how can i update the Sqlite Resultset in java. 请帮助我如何在Java中更新Sqlite结果集。

If you want to get different values than those actually stored in the database, you can do these changes in the SQL query itself. 如果要获得与实际存储在数据库中的值不同的值,则可以在SQL查询本身中进行这些更改。 In the most general case, you can use a CASE expression : 在最一般的情况下,您可以使用CASE表达式

SELECT ID,
       Name,
       [...],
       CASE Status
         WHEN 'A' THEN 'active'
         WHEN 'D' THEN 'inactive'
         ELSE          'whatever'
       END AS Status
FROM MyTable

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM