ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ½Ð°Ý¦p¦ó¨ú±o¸ê®Æ®wÁ`µ§¼Æ

[µo°Ý] ½Ð°Ý¦p¦ó¨ú±o¸ê®Æ®wÁ`µ§¼Æ

½Ð°Ý¥H¤Uµ{¦¡»Ý¦p¦ó­×§ï
¤~¯à¨ú±o¸ê®Æ®wÁ`µ§¼Æ
·PÁ±z

    Dim MYCON As ADODB.Connection
    Dim MYRS As ADODB.Recordset
    Set MYCON = New ADODB.Connection
    MYCON.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & ¸ê®Æ®w
    Set MYRS = New ADODB.Recordset
   
    With MYRS
        .Source = "SELECT * FROM DATA"
        .ActiveConnection = MYCON          '«ü©w©Ò¨Ï¥ÎªºConnectionª«¥ó
        .Open
    End With
   
    MsgBox ¸ê®Æ®wÁ`µ§¼Æ
   
    MYRS.Close
    Set MYRS = Nothing
    MYCON.Close
    Set MYCON = Nothing

¤£¦n·N«ä¡A¦A½Ð°Ý
MsgBox ²{¦b¦ì©ó¸ê®Æ®w²Ä´Xµ§¸ê®Æ
³Â·Ð¦U¦ì¤j¤j

TOP

¥»©«³Ì«á¥Ñ et5323 ©ó 2010-10-11 11:18 ½s¿è

MsgBox "¸ê®Æ®wÁ`µ§¼Æ=" & MYRS.recordcount

TOP

¦^´_ 3# et5323


    ±z¦n¡A·PÁ±zªº¦^µª
§Ú¨Ï¥Î¤F MsgBox MYCON.RecordCount
µ²ªGµ{¦¡¦^À³¤U¦C°T®§
°õ¦æ¶¥¬q¿ù»~'3001'
¤Þ¼Æ¤¤¥i¯àµo¥ÍÃþ«¬¡B¶W¹L¥i±µ¨üªº©w¸q½d³ò¡B©Î»P¨ä¥L¤Þ¼Æµo¥Í½Ä¬ð¡C

¦pªG¨Ï¥Î MsgBox MYRS.RecordCount
·|¶Ç¦^ -1

¦pªG¨Ï¥Î MsgBox MYRS.Fields("¤º®e")
·|¶Ç¦^ ¥¿½T¸ê®Æ

¤´µMµLªk¨ú±o Á`µ§¼Æ¤Î¥Ø«e¦ì¸m

TOP

两个¤èªk:
1.
With MYRS
        .CursorLocation = adUseClient     '设¸m´å标ªA务ªº¦ì¸m
        .Source = "SELECT * FROM DATA"
        .ActiveConnection = MYCON          '«ü©w©Ò¨Ï¥ÎªºConnectionª«¥ó
        .Open
    End With
    MsgBox MYRS.RecordCount
2.
MYRS.Open "SELECT * FROM DATA", MYCON, 1, 1
    MsgBox MYRS.RecordCount

¬Û关内®e¬Ý:
Microsoft ADO µ{§Ç员参¦Ò

TOP

¦^´_ 5# et5323


·PÁ±zªº¦^µª
§Ú¥Î²Ä¤@­Ó¤èªkOK¡A¶Ç¦^¥¿½Tªº103µ§
²Ä¤G­Ó¤èªk¶Ç¦^15µ§(¿ù»~)

ÁÂÁ±zµ¹ªº³sµ²

TOP

thank you§Aªº¦^µª¾Ç²ß¤F

TOP

        ÀR«ä¦Û¦b : ¡i®É¶¡¦pÆp¥Û¡j®É¶¡¹ï¤@­Ó¦³´¼¼zªº¤H¦Ó¨¥¡A´N¦pÆp¥Û¯ë¬Ã¶Q¡F¦ý¹ï·M¤H¨Ó»¡¡A«o¹³¬O¤@§âªd¤g¡A¤@ÂI»ù­È¤]¨S¦³¡C
ªð¦^¦Cªí ¤W¤@¥DÃD