从RestulSet表编辑JTable [英] Editing JTable from RestulSet Table

查看:149
本文介绍了从RestulSet表编辑JTable的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

继续问题.

我的问题是我无法编辑JTable.我得到了一个异常,并且得到了Object值,而不是我应该看到的.

My problem is that I can not edit my JTable. I get an exception and the Object value instead of what I should be seeing.

我正在将 ResultSet Table 代码与MS-Access数据库,并进行了一些修改.可以在此处找到我的代码.调用rs.updateRow()时遇到错误. java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]Error in row .

I am using the ResultSet Table code with a MS-Access database and with a few modifications. My code can be found here. I run into an error when I rs.updateRow() is called. java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]Error in row.

我用updateRow()在此错误上进行了google搜索,但结果不多.我看到的唯一真正的答案是使用准备好的语句,但我不是SQL命令的专业人士.

I did a google search on this error with updateRow() and not much came up. The only real answer I saw was to use a prepared statement but I am not a pro with SQL commands.

如果您能告诉我使它成为GlazedList的最佳方法的话,也是一个加号,这样我可以轻松进行过滤.除非您能为我提供可以轻松过滤常规JTables的内容.

Also a plus if you could tell me the best approach in making this become a GlazedList so I can filter easily. Unless you can provide me something that filters regular JTables easily.

推荐答案

尝试提供更多帮助,因为初始解决方案无法100%正常工作.

Trying to offer more help since the initial solution didn't work 100%.

在此处尝试信息:可更新的结果集了解如何从Connection创建Statement对象时通过指定参数来使ResultSet可更新.我意识到默认情况下可能未设置此选项.如果您的驱动程序支持此模式,则应允许代码正常工作.

Try the info here: Updatable ResultSets to see how to make your ResultSet updatable by specifying arguments when creating a Statement object from your Connection. I realized this option may not have been set by default for you. If you driver supports this mode, it should allow the code to work.

它不一定是驱动程序(尽管如果您要更改它,则需要JAR).创建表时需要启用ResultSet.TYPE_SCROLL_SENSITIVE-驱动程序可能仍支持此模式.有多种方法可以探查JDBC驱动程序支持的功能,但是除非您使用SquirrelSQL Client这样的GUI来获取功能的完整列表,否则使用它们会有些痛苦.

It's not necessarily the driver (though you will need a JAR if you wish to change that). You need to enable ResultSet.TYPE_SCROLL_SENSITIVE when creating the table -- the driver may still support this mode. There are ways to probe what the JDBC driver supports, but they're kind of a pain to use unless you use a GUI like SquirrelSQL Client to get a full list of capabilities.

这篇关于从RestulSet表编辑JTable的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆