[µo°Ý] ADO - SQL ¨ú±oÄæ¦ì¤º ¤£«ÂÐÈ ¨Ã±Æ°£ ªÅÈ
- ©«¤l
- 62
- ¥DÃD
- 10
- ºëµØ
- 0
- ¿n¤À
- 253
- ÂI¦W
- 0
- §@·~¨t²Î
- xp , win7
- ³nÅ骩¥»
- office2003
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¤H¤ß
- µù¥U®É¶¡
- 2010-5-21
- ³Ì«áµn¿ý
- 2012-8-3
|
[µo°Ý] ADO - SQL ¨ú±oÄæ¦ì¤º ¤£«ÂÐÈ ¨Ã±Æ°£ ªÅÈ
¥»©«³Ì«á¥Ñ ·t¶Â ©ó 2010-6-11 17:06 ½s¿è
½Ð±Ð¦U¦ì¤j¤j
ADO SQL ªº»yªk
¸ê®Æªí A
Äæ¦ì¦WºÙ¡G1 ,2 , 3
§Ú¤UªºSQL»yªk ¦p¤U
1. ¤£²z·|ªÅÈ
Select Distinct 2 Form A
µ²ªG¡Gªð°jÈ ¬°-1
2. ±Æ°£ªÅÈ
2.1 Select Distinct 2 Form A Where 2<>''
µ²ªG¡G¿ù»~
2.2 Select Distinct 2 Where 2<>'' Form A
µ²ªG¡G¿ù»~
½Ð°Ý¦U¦ì¤j¤j¡A«ü¾É¤@¤U¡A»yªkn¦p¦ó¤U¡A§Ú½T©w¸ê®Æ®w¤º¬O¦³¸ê®Æªº¡A´N¬OµLªk¿z¥X¡A½Ð«ü¾É
§Ú¬d¤F¤@¤Uado ¦^ÂÐ
1. underlyingVale:¥Ø«e´£¨ÑªÌ¤£¤ä´©«·s¾ã²z°ò©³È
2. LockType:adLockReadOnly (¥i¬O§Ú¬O¤ULockType:adLockPessimistic)
3. OriginalValue:¥Ø«eªº¸ê®Æ¿ý¶°¤£¤ä´©§ó·s¡C³o¥i¯à¦¨¬°´£¨ÑªÌ©Î©Ò¿ï©wÃþ«¬ªº¨î
¥i¬O §ÚÁÙ¬O¤£ª¾¹D°ÝÃD¦b¨º¡A½Ð¦U¦ì¥ý¶i«ü¾É¤@¤U |
|
¬O¾Çµ{¦¡¦Ó¤£¬Onµ{¦¡¡A¬O¶i¨Bªº°ò¦
|
|
|
|
|
- ©«¤l
- 62
- ¥DÃD
- 10
- ºëµØ
- 0
- ¿n¤À
- 253
- ÂI¦W
- 0
- §@·~¨t²Î
- xp , win7
- ³nÅ骩¥»
- office2003
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¤H¤ß
- µù¥U®É¶¡
- 2010-5-21
- ³Ì«áµn¿ý
- 2012-8-3
|
§ä¨ì¤F...
¦] ¨Ï¥Î Distinct ¬°¦^¶ÇºA¬°°ßŪȡA¬G ado LockType n¨Ï¥Î adLockReadOnly
.theRST.RecordCount ¡A¤~·|¦^¶Çµ§¼Æ |
-
1
µû¤À¤H¼Æ
-
-
¤p»x:
¦Û§U¦Ó«Dµ¥«Ý¤H§U,¬°§Aªººë¯«¥[¤Àª÷¿ú + 1
|
¬O¾Çµ{¦¡¦Ó¤£¬Onµ{¦¡¡A¬O¶i¨Bªº°ò¦
|
|
|
|
|
- ©«¤l
- 62
- ¥DÃD
- 10
- ºëµØ
- 0
- ¿n¤À
- 253
- ÂI¦W
- 0
- §@·~¨t²Î
- xp , win7
- ³nÅ骩¥»
- office2003
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¤H¤ß
- µù¥U®É¶¡
- 2010-5-21
- ³Ì«áµn¿ý
- 2012-8-3
|
¥»©«³Ì«á¥Ñ ·t¶Â ©ó 2010-6-14 11:40 ½s¿è
èè ¥Î excel 2003 ¤@¼Ò¤@¼Ë ªºµ{¦¡ ¤U¥h°õ¦æ¡Aµ²ªG ¸ê®Æ¬O¦³¦^¶Çªº
½Ð°Ý¦U¦ì¤j¤j¡G
myDbSqlSpcIqc.theRST.RecordCount À³¸Ó¬O¦^¶Ç¸ê®Æµ§¼Æ(88µ§)¡Aµ²ªG¦^¶ÇȬO-1¡A³o¬O¤°»ò°ÝÃD©O¡A¬O§Úado¼Ò¦¡¦³°Ý¬O ÁÙ¬O...
ps: adoµ{¦¡¬q§Ú¬O¼g¼Ò²Õªº¼Ò¦¡¡A³oÓado ¤w³Q°õ¦æ¦h¦¸¡A¥u¦³ sql ¤U Distinct ®É¦³°ÝÃD
¶Ç»¼È¡G
strCMn="select Distinct ¥[¤u¼t°Ó from °U¥~_¥b¦¨«~"
ado µ{¦¡¬q
Dim theCON As ADODB.Connection
Public theRST As ADODB.Recordset
Sub subConn(strFullName As String)
Dim strDrv As String
Dim IQC_SQLPass$, IQC_SQLID$, IQC_SQLName$, IQC_SQLAdderss$
IQC_SQLPass = "yyyyy"
IQC_SQLID = "yy"
IQC_SQLName = "Spc-Iqc"
IQC_SQLAdderss = "192-168-100-199\SQLEXPRESS"
theCON.Open "Provider=SQLOLEDB.1;Password=" & IQC_SQLPass & ";Persist Security Info=True;User ID=" & IQC_SQLID & ";Initial Catalog=" & IQC_SQLName & ";Data Source=" & IQC_SQLAdderss
End Sub
Sub subOpen(strCMn As String)
theRST.Open Source:=strCMn, ActiveConnection:=theCON, _
CursorType:=adOpenStatic, LockType:=adLockPessimistic, Options:=adCmdText
End Sub
Private Sub Class_Initialize()
Set theCON = New ADODB.Connection
Set theRST = New ADODB.Recordset
End Sub
Private Sub Class_Terminate()
theCON.Close
Set theRST = Nothing
Set theCON = Nothing
End Sub |
|
¬O¾Çµ{¦¡¦Ó¤£¬Onµ{¦¡¡A¬O¶i¨Bªº°ò¦
|
|
|
|
|