今天做一程序,使用Command对象的ExecuteNonQuery()执行一个select语句,我确定 数据库有响应的数据,但返回值总是-1,查帮助知:
Command对象的ExecuteNonQuery() update insert delete语句才会返回影响的行数,但对select只返回-1
那么如果我要判断ID=1的记录是否存在应该用什么方法呢? ExecuteNonQuery()不行了
ExecuteReader()又感觉资源浪费,麻烦 不知道各位朋友是怎么做的?