;
帖子
3919 
精华
积分
11710 
鱼币
0 ¥ 
来自
大连 
在线时间
1858 小时 
注册时间
2007-6-11 
最后登录
2009-10-20 

贴图大师勋章新人进步勋章宣传大使勋章论坛元老勋章

3
发表于 2009-1-5 19:48 | 只看该作者
鍦≧ecordset瀵硅薄涓煡璇㈣褰曠殑鏂规硶 - 缂栫▼搴 - Powered by SupeSite

浣犵殑浣嶇疆锛缂栫▼搴 >> 璧勮 >> 鏁版嵁搴撶鐞 >> ACCESS >> 璇︾粏鍐呭 鍦ㄧ嚎鎶曠ǹ

鍦≧ecordset瀵硅薄涓煡璇㈣褰曠殑鏂规硶

鍙戝竷: 2008-7-01 15:14 |  浣滆: admin |   鏌ョ湅: 50娆

鍦≧ecordset瀵硅薄涓煡璇㈣褰曠殑鏂规硶

銆愬瓧浣擄細灏 澶с

鍦≧ecordset瀵硅薄涓煡璇㈣褰曠殑鏂规硶

浣滆咃細- 鏂囩珷鏉ユ簮锛- 鐐瑰嚮鏁帮細756 鏇存柊鏃堕棿锛2006-12-13

鏃犺鏄 DAO 杩樻槸 ADO 閮芥湁涓ょ浠 Recordset 瀵硅薄涓煡璇㈣褰曠殑鏂规硶锛 Find 鏂规硶鍜 Seek 鏂规硶銆傚湪杩欎袱绉嶆柟娉曚腑鍙互璁╀綘鎸囧畾鏉′欢杩涜鏌ヨ涓庡叾鐩稿簲鐨勮褰 , 涓鑸岃█锛屽湪鐩稿悓鏉′欢涓嬶紝 Seek 鏂规硶鎻愪緵浜嗘瘮 Find 鏂规硶鏇村ソ鐨勬ц兘锛屽洜涓 Seek 鏂规硶鏄熀浜庣储寮曠殑銆傚洜涓鸿繖涓師鍥犲熀鏈彁渚涜呭繀椤绘敮鎸 Recordset 瀵硅薄涓婄殑绱㈠紩锛屽彲浠ョ敤 Supports ( adSeek ) 鏂规硶纭畾鍩烘湰鎻愪緵鑰呮槸鍚︽敮鎸 Seek 锛岀敤 Supports ( adIndex ) 鏂规硶纭畾鎻愪緵鑰呮槸鍚︽敮鎸佺储寮曘傦紙渚嬪锛 OLE DB Provider for Microsoft Jet 鏀寔 Seek 鍜 Index 銆傦級锛岃灏 Seek 鏂规硶鍜 Index 灞炴х粨鍚堜娇鐢ㄣ傚鏋 Seek 娌℃湁鎵惧埌鎵闇鐨勮锛屽皢涓嶄細浜х敓閿欒锛岃琛屽皢琚斁鍦 Recordset 鐨勭粨灏惧銆傛墽琛屾鏂规硶鍓嶏紝璇峰厛灏 Index 灞炴ц缃负鎵闇鐨勭储寮曘傛鏂规硶鍙彈鏈嶅姟鍣ㄧ娓告爣鏀寔銆傚鏋 Recordset 瀵硅薄鐨 CursorLocation 灞炴у间负 adUseClient 锛屽皢涓嶆敮鎸 Seek 銆傚彧鏈夊綋 CommandTypeEnum 鍊间负 adCmdTableDirect 鏃舵墦寮 Recordset 瀵硅薄锛屾墠鍙互浣跨敤姝ゆ柟娉曘

鐢 ADO Find 鏂规硶

DAO 鍖呭惈浜嗗洓涓 Find 鈥濇柟娉曪細 FindFirst,FindLast,FindNext 鍜 FindPrevious .

DAO 鏂规硶 ADO Find 鏂规硶

涓嬮潰鐨勪竴涓緥瀛愮ず鑼冧簡濡備綍鐢 ADO Find 鏂规硶鏌ヨ璁板綍锛

Sub FindRecord(strDBPath As String, _

strTable As String, _

strCriteria As String, _

strDisplayField As String)

' This procedure finds a record in the specified table by

' using the specified criteria.

' For example, to use this procedure to find records

' in the Customers table in the Northwind database

' that have " USA " in the Country field, you can

' use a line of code like this:

' FindRecord _

' "c:\Program Files\Microsoft Office\Office\Samples\Northwind.mdb", _

' "Customers", "Country=' USA '", "CustomerID"

Dim cnn As ADODB.Connection

Dim rst As ADODB.Recordset

' Open the Connection object.

Set cnn = New ADODB.Connection

With cnn

.Provider = "Microsoft.Jet.OLEDB.4.0"

.Open strDBPath

End With

Set rst = New ADODB.Recordset

With rst

' Open the table by using a scrolling

' Recordset object.

.Open Source:=strTable, _

ActiveConnection:=cnn, _

CursorType:=adOpenKeyset, _

LockType:=adLockOptimistic

' Find the first record that meets the criteria.

.Find Criteria:=strCriteria, SearchDirection:=adSearchForward

' Make sure record was found (not at end of file).

If Not .EOF Then

' Print the first record and all remaining

' records that meet the criteria.

Do While Not .EOF

Debug.Print .Fields(strDisplayField).Value

' Skip the current record and find next match.

.Find Criteria:=strCriteria, SkipRecords:=1

鎵撳嵃 | 鏀惰棌姝ら〉 |  鎺ㄨ崘缁欏ソ鍙 | 涓炬姤
涓婁竴绡 涓嬩竴绡
 

璇勫垎锛0

鍙戣〃璇勮
鏌ョ湅鍏ㄩ儴鍥炲銆愬凡鏈0浣嶇綉鍙嬪彂琛ㄤ簡鐪嬫硶銆