你好
小女子是一名電腦書院的學生
想問問你們有關vb ADO<access> 的問題
希望各位高手能賜教
我用如下的方法成功open了一個 mdb
================================================
Dim db As Connection
Dim conn As ADODB.Connection
Dim cmd1 As New ADODB.Command
Dim rs1 As New ADODB.Recordset
Private Sub Form_Load()
Set conn = CreateObject("ADODB.Connection")
conn.Open "ass2"
Set cmd1.ActiveConnection = conn
cmd1.CommandText = "SELECT * FROM [pb]"
rs1.CursorLocation = adUseClient
rs1.Open cmd1, , adOpenDynamic, adLockBatchOptimistic
Set Adodc1.Recordset = rs1
End Sub
'===================================================
但是,當我想把display出來的mdb資料變更時(如下)卻失敗了,有ERROR
請問我應該如果寫Command1_Click() 的 code 才可成功更改 "cmd1.CommandText " 的內容呢?
===================================================
Private Sub Command1_Click()
cmd1.CommandText = "SELECT * FROM [pb] WHERE id>100"
rs1.CursorLocation = adUseClient
rs1.Open cmd1, , adOpenDynamic, adLockBatchOptimistic
Set Adodc1.Recordset = rs1
End Sub
'===================================================
如能相助,小女子會向你敬上萬分謝意
Thank you!!