sql
  • mysql
  • excel
  • vba
  • adodb
  • 2010-05-14 61 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

    相關問題