顯示具有 rs2 標籤的文章。 顯示所有文章
顯示具有 rs2 標籤的文章。 顯示所有文章

2010年6月28日 星期一

EXCEL VBA ADO資料操作 WHILE WEND

'載入資料庫 所需引用相關變數
Dim conn2 As New ADODB.Connection
Dim rs2 As New ADODB.Recordset
Dim SqlString As String
Dim i As Integer

conn2.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & ThisWorkbook.Path & "\holidaydb.MDB"

SqlString = " select * From [DB] "

rs2.Open SqlString, conn2, adOpenKeyset, adLockOptimistic

rs2.MoveLast
rs2.Delete
rs2.Update

MsgBox "您已成功刪除[剛才建立的資料]!"

>>>>>>
While not rs2.eof
xxxxxxxxxxxxx
rs2.movenext
wend

追蹤者