sql
  • mysql
  • excel
  • vba
  • adodb
  • 2010-05-14 104 views 0 likes 
    0

    我使用Excel来连接到MySQL数据库ADODB .FIND问题

    我这样做:

    rs.Find "rowid='105'" 
    If Not rs.EOF Then cn.Execute "delete from batchinfo where rowid='105'" 
    

    ,而且运作良好

    然而

    ,我需要能够匹配多列数据,例如像这样:

    rs. find "rowid='105'" and "something='sometext'" and "somethingelse='moretext'" 
    

    我需要知道rs.find是否匹配所有的数据。

    我该怎么做?

    根据这个我不能: https://web.archive.org/web/1/http://articles.techrepublic%2ecom%2ecom/5100-10878_11-1045830.html#

    但也许有办法可以rs.execute“一些select语句” 有人可以帮助这一点?

    会这样做的伎俩对我,然后我会检查EOF:

    rs.Filter "LastName='Adams' and FirstName='Lamont'" 
    

    回答

    1

    你可以做这一切在SQL这样的:

    DELETE FROM batchinfo where rowid='105' 
    AND EXISTS (SELECT * FROM batchinfo WHERE rowid='105' and something='sometext' and somethingelse='moretext') 
    
    +0

    奔我真的不明白的语法你能请解释? – 2010-05-14 16:11:14

    +0

    错误:您无法在第 – 2010-05-14 16:14:38

    +1

    版中指定更新目标表的批处理信息为什么存在位?为什么不仅仅是'DELETE FROM batchinfo where rowid ='105'and something ='sometext'and somethingelse ='moretext''?记录受影响的属性可用于检查删除的记录。 – Fionnuala 2010-05-14 16:27:32

    相关问题