Simple getColumnName(0) call throws Invalid column index: getValidColumnIndex

前端 未结 2 1040
半阙折子戏
半阙折子戏 2021-01-12 02:18

I\'m trying to write a JTable that takes the data from a ResultSet and uses that to create a dynamic sized table with appropriate column names and row data values from the R

相关标签:
2条回答
  • 2021-01-12 02:48

    Column index starts by 1. So increase your variable pointing column variable by 1.

    0 讨论(0)
  • 2021-01-12 02:49

    JDBC column indexes start from 1 and not 0. As far as possible, it is better to retrieve data using column names to avoid hard dependency on the order of columns in the results.

    0 讨论(0)
提交回复
热议问题