MFC中ADO连接数据库 SQL语句执行有误,该怎么解决
MFC中ADO连接数据库 SQL语句执行有误
为什么m会是-1呢,我在sql server2008中测试该语句是有结果的,不要怀疑我数据库连接失败,我在程序的其他地方已经连接成功,并数据处理是正确的。不知道这个是怎么回事,求大侠帮帮忙
------解决方案--------------------
据说
The record count is maintained as a “high water mark” — the highest-numbered record yet seen as the user moves through the records. The total number of records is only known after the user has moved beyond the last record.
也就是说,GetRecordCount返回的是数据表曾经移动到的最大记录号,因此只有你通过MoveNext方式直到IsEOF返回TRUE之后,GetRecordCount才会返回正确的记录数。
------解决方案--------------------
之前也遇到过这个问题,记录在博客里了。
_RecordsetPtr对象的GetRecordCount()方法总是返回-1
------解决方案--------------------
设置连接的CursorLocation=adUseClient,否则,记录数为-1
------解决方案--------------------
很强大,又学习了一下
------解决方案--------------------
那是一个博客连接,你点进去看一下,你是不是把这句话当作一个结论了。
为什么m会是-1呢,我在sql server2008中测试该语句是有结果的,不要怀疑我数据库连接失败,我在程序的其他地方已经连接成功,并数据处理是正确的。不知道这个是怎么回事,求大侠帮帮忙
------解决方案--------------------
据说
The record count is maintained as a “high water mark” — the highest-numbered record yet seen as the user moves through the records. The total number of records is only known after the user has moved beyond the last record.
也就是说,GetRecordCount返回的是数据表曾经移动到的最大记录号,因此只有你通过MoveNext方式直到IsEOF返回TRUE之后,GetRecordCount才会返回正确的记录数。
------解决方案--------------------
之前也遇到过这个问题,记录在博客里了。
_RecordsetPtr对象的GetRecordCount()方法总是返回-1
------解决方案--------------------
设置连接的CursorLocation=adUseClient,否则,记录数为-1
------解决方案--------------------
很强大,又学习了一下
------解决方案--------------------
那是一个博客连接,你点进去看一下,你是不是把这句话当作一个结论了。