客戶光標(biāo)的產(chǎn)生由來已久,當(dāng)初是為了彌補(bǔ)服務(wù)器的不足(有些數(shù)據(jù)庫引擎就不支持光標(biāo))。隨著服務(wù)器光標(biāo)的出現(xiàn),客戶光標(biāo)似乎已經(jīng)過時(shí)了,不過還是那句話:萬事都有兩面性,在 internet 上,與數(shù)據(jù)庫的連接并不是永久的,使用客戶光標(biāo)能使我們獲得同使用服務(wù)器光標(biāo)一樣的功能。
Dim c As New ADODB.Connection Dim r As New ADODB.Recordset On Error GoTo handler
c.ConnectionString = connectStr c.CursorLocation = adUseClient c.Open Set r.ActiveConnection = c r.Open SqlText, , adOpenKeyset, adLockBatchOptimistic, -1 Set r.ActiveConnection = Nothing ' This disconnects the recordset. c.Close Set c = Nothing ...... ...... ' Recordset is now in disconnected state; do something with it. r.Close Set r = Nothing ......