Nip*_*una 2 java mysql jdbc sqlexception resultset
ResultSet rs;
rs = this.orderedProduct.select(" sum(unitstoproduce) "," soNo = "+ soNo);
int sum = Integer.parseInt(rs.getString(1));
Run Code Online (Sandbox Code Playgroud)
当我尝试在java类中执行上述查询时,我得到如下的异常.这里有orderedProduct(orderedZnAlProduct)是表
SELECT sum(unitstoproduce) FROM orderedZnAlProduct WHERE soNo = '15005'
java.sql.SQLException: Before start of result set
Run Code Online (Sandbox Code Playgroud)
oyo*_*oyo 11
我没有看到您的查询执行的位置(如statement.executeQuery())但是,当光标位置不正确时,通常会发生这种错误.您需要调用类似rs.next()或rs.first()移动光标然后获取结果的内容.
| 归档时间: |
|
| 查看次数: |
9042 次 |
| 最近记录: |