打印本文 打印本文 关闭窗口 关闭窗口
第四课 使用SqlDataReader读取数据(翻译)
作者:武汉SEO闵涛  文章来源:敏韬网  点击数15050  更新时间:2007/11/14 13:12:43  文章录入:mintao  责任编辑:mintao
        {

               // data access code

        }

        finally

        {

               // 3. close the reader

               if (rdr != null)

               {

                       rdr.Close();

               }

 

               // close the connection too

        }      

The code above checks the SqlDataReader to make sure it isn''''t null.  After the code knows that a good instance of the SqlDataReader exists, it can close it.  Listing 1 shows the code for the previous sections in its entirety.

上面的代码检测SqlDataReader,确保它不为空。在代码知道SqlDataReader的一个完好的实例存在,它就能够关闭它。Listing1

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]  ...  下一页 >> 

打印本文 打印本文 关闭窗口 关闭窗口