看板 Visual_Basic 關於我們 聯絡資訊
直接寫 insert,並且在 insert 加上檢查條件 if not exists(select * from 資料表 where 條件) insert into ... 每一筆資料 execute 一次 ※ 引述《NealPope (尼爾教皇)》之銘言: : 問VB寫進資料庫一些問題 : 某段跑回圈程式如下↓ : For i = 0 to Ubound(temp()) : aa = Split(temp(i),";") : sPord = aa(0) : sMoney = aa(1) : sTime = aa(2) : '開始寫入資料庫 : rs.AddNew : rs("pord") = sPord : rs("money") = sMonry : rs("now_time") = sTime : rs.updatebatch : Next : 資料庫欄位pord、money、now_time已設唯一值 : 當有相同值時,就會Error : 要如何判斷資料庫已經有此筆資料時,自動跳到下一個迴圈? : 不能用 If rs.EOF或rs.Rcordcount : 資料庫好像不允許迴圈Select瘋狂查詢 -- 携帯の待ち受けには 笑顔のMai-Kがいる -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 123.194.79.177 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Visual_Basic/M.1597157767.A.165.html
NealPope: 大大,這樣我的rs.AddNew是不是要改成cn.excute "If not 08/11 23:50
NealPope: exisys..." 08/11 23:50
fumizuki: 對 08/12 21:46