记录集问题
rs = ldao.getLonaAllList(schemeName, memid, TStrCalcdt);
if(!rs.next())
{
MessageBox mb = new MessageBox(sh, SWT.ICON_INFORMATION);
mb.setMessage("No Data Found");
mb.open()
return;
}
while (rs.next()) {
//other code for bringing the dat
}
我想检查,如果记录不包含数据,那么它会显示消息。但我发现问题是,在每种情况下获取记录时,第一个记录集数据不会显示。 所以请任何机构可以帮忙解决这个问题。如何在不丢失数据集中的第一个数据的情况下显示记录集不包含任何数据
rs = ldao.getLonaAllList(schemeName, memid, TStrCalcdt);
if(!rs.next())
{
MessageBox mb = new MessageBox(sh, SWT.ICON_INFORMATION);
mb.setMessage("No Data Found");
mb.open()
return;
}
while (rs.next()) {
//other code for bringing the dat
}
i want to check, if the record doesnot contain the data then it shows the message. but i found the problem that while getting the record in every case, the first recordset data is not displayed.
so please can any body help on this. how can i show that the record set does not contain any data without losing my first data in dataset
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于 rs.next() 已经移动到下一条记录,并且在进入循环体之前调用它两次,因此很明显第一条记录被跳过。将
while
循环替换为do
-while
:(所有这些都假设您实际上正在谈论
ResultSet
或具有类似界面的东西)。Since
rs.next()
already moves to the next record and you call it twice before you enter the loop body, it is clear that the first record gets skipped. Replace yourwhile
loop with ado
-while
:(All of this assumes you're actually talking about a
ResultSet
or something with a similar interface).