`

before start of result set 是什么错误

 
阅读更多

      在使用ResultSet时发生的错误:

 

ResultSet rs=st.executeQuery();
//直接rs.getString("Name") 会报错before start of result set
//要使用
while(rs.next()){
rs.get...;
}
//如果确定了rs里面只有一条数据可以不用循环,直接使用if(rs.next())即可
if(rs.next()){
 rs.get...;
}

百度得到:即使你十分确定能搜出记录,也不可以在没有rs.next()之前直接对rs进行取值。
这涉及到rs对象的存储方法。里面说白了就是指针。没next,指针根本没指向对应记录

分享到:
评论

相关推荐

    machine learning 机器 学习

    Before entering the building each person has to look into a camera so we can take a still image of their face. For our purposes it suffices just to decide based on the image whether the person can ...

    微软内部资料-SQL性能优化2

    Before we look at how SQL Server uses and manages its memory, we need to ensure a full understanding of the more common memory related terms. The following definitions will help you understand how SQL...

    Java邮件开发Fundamentals of the JavaMail API

    Fundamentals of the JavaMail API Presented by developerWorks, your source for great tutorials ibm.com/developerWorks Table of Contents If you're viewing this document online, you can click ...

    微软内部资料-SQL性能优化3

    SQL Server never asks for SIX locks directly, they are always the result of a conversion. For example, suppose a transaction scanned a page using an S lock and then subsequently decided to perform a ...

    2009 达内Unix学习笔记

    集合了 所有的 Unix命令大全 ...telnet 192.168.0.23 自己帐号 sd08077-you0 ftp工具 192.168.0.202 tools-toolss ... 各个 shell 可互相切换 ksh:$ sh:$ csh:guangzhou% bash:bash-3.00$ ... 命令和参数之间必需用空格隔...

    VclZip pro v3.10.1

    This modification means that if you are creating zip files to be used as SFX's you will want to leave the OEMConvert property mentioned above, set to it's default value of True. Modified so that ...

    BobBuilder_app

    Please click here to have a confirmation email sent so we can confirm your email address and start sending you newsletters again. Alternatively, you can update your subscriptions. Add your own ...

    [磁盘整理] O&O Defrag Professional 16.0 Build 345

    This occurs as a result of frequent write and read access, during your daily routines, while surfing or gaming, or due to frequent user access on Server. For a lasting maximum speed while accessing ...

    C# Game Programming Cookbook for Unity 3D - 2014

    4.4 Set Gravity.........................................................66 4.5 Pretend Friction—Friction Simulation to Prevent Slipping Around........66 4.5.1 Script Breakdown...........................

    UG6.0快捷键大全

    POPUP_MESSAGE Adds or removes members of the selected feature set. ACTIONS STANDARD END_OF_MENU ! *************** Edit Menu *************** AFTER UG_EDIT_UNDO_LIST BUTTON UG_EDIT_REDO LABEL &...

    计算时间差以及比较日期大小

    LocalDateTime start = LocalDateTime.parse("2004-01-02 11:30:24", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); LocalDateTime end = LocalDateTime.parse("2004-03-26 13:31:40", DateTimeFormatter....

    Turbo C++ 3.0[DISK]

    To start the installation, change your current drive to the one that has the install program on it and type INSTALL. You will be given instructions in a box at the bottom of the screen for each ...

    Turbo C++ 3.00[DISK]

    To start the installation, change your current drive to the one that has the install program on it and type INSTALL. You will be given instructions in a box at the bottom of the screen for each ...

    Delphi7.1 Update

    * When using RefreshRecord on a Memo or Blobfield and the field has been modified by another user, the blobsize of that field does not change if it is less than before (Quality Central 4676).* ...

    xplite_trial

    XPlite will set a restore point before making any changes to your system and it will warn you first if the restore point can not be set. Source Files ============ When installing optional components...

    php.ini-development

    Instead, explicitly set the output handler using ob_start(). ; Using this ini directive may cause problems unless you know what script ; is doing. ; Note: You cannot use both "mb_output_handler" with...

    Google C++ Style Guide(Google C++编程规范)高清PDF

    Table of Contents Header Files The #define Guard Header File Dependencies Inline Functions The -inl.h Files Function Parameter Ordering Names and Order of Includes Scoping Namespaces Nested Classes ...

    高频常用英语的胶水词.docx

    例句:The accident occurred as the result of careless driving. - **because of**:表示原因。例句:Because of the heavy traffic, we were late. - **due to**:表示原因。例句:The delay was due to bad ...

    BURNINTEST--硬件检测工具

    - Corrected a bug, where in rare cases, the result summary could be duplicated in a log file. - Updated license management, in an attempt to remove a rare crash on startup. Release 5.3 build 1012....

    LCTF软件备份VariSpec™ Liquid Crystal Tunable Filters

    For this reason, the functions that handle these actions offer the option of waiting until the action is complete before returning (so-called synchronous operation); although they can be called in an ...

Global site tag (gtag.js) - Google Analytics