请教各位大虾, 用什么样的方法来扫描一张表, 把新加入表中的数据取出来比较好?能不能给个简单的事例, 或指点一些方法和需要注意大事项.因为考虑到程序的实时性和长时间的运行问题,希望不要因此而出什么错误。(环境:VC+ADO+SQLSERVER)谢谢大家!

解决方案 »

  1.   

    谢谢楼上,其实区别表中的记录是否处理倒是其次,在表中加个处理标志就可以了,我想知道的是用ADO扫描的一般步骤和方法,还有一些保证程序可靠性的地方,楼上有别的建议吗?还有大虾肯帮忙吗?
      

  2.   

    不是有trigger么?在trigger中使用sp_oacreate创建一个自己的com对象,用com通知程序。
    更简单地就是在表中增加一个已扫描标志和已扫描时间,insert时置空,扫描完了再赋值。
      

  3.   

    Thanks for your help! But maybe, I must say sorry that I do not make you understand my question clearly.
    I do want the method and steps to get the new records from the database table with ADO, for instance, at first I know I must create a connection to the database with the function ADODB::Open(), but what can I do afterwards? My idea is opening a record set in a RecordsetPtr object directly, and then checking whether there is new record inserted to determine the program's action. Certainly I have to close the record set at last. This is a circle. In the next circle in 30 seconds, I repeat the process above from opening a record set as begining. Okay, that's my opinion, I wonder that whether it's correct or not. If not, could you please show me a appropriate solution?
    Very sorry for typing the words in English, as my computer doesn't work in Chinese.
    My appreciation for every one post his words here!
      

  4.   

    我也想过用触发器,但程序不只是要得到新插入的项,还有很多别的工作要做,触发器好象不是太方便,所以我只是想知道用ADO直接操作的方法,谢谢各位帮忙,还有人帮忙看看吗?