«ç»òŪ¨úrecordsetªº¦UÄæ¦ìªºÈ
- ©«¤l
- 4
- ¥DÃD
- 2
- ºëµØ
- 0
- ¿n¤À
- 57
- ÂI¦W
- 0
- §@·~¨t²Î
- winxp
- ³nÅ骩¥»
- sp3
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- tainan
- µù¥U®É¶¡
- 2012-8-1
- ³Ì«áµn¿ý
- 2021-12-18
|
«ç»òŪ¨úrecordsetªº¦UÄæ¦ìªºÈ
Dim cn
DbName="DB.accdb"
sql_command="select * from baseinfo"
Set cn = CreateObject("adodb.connection")
cn.Open "Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=" & ThisWorkbook.Path & "\" & DbName
Set rs = cn.Execute(sql_command)
sheets"(sheet1").cells(1,1)=rs.fields(0).vale
cn.Close
sheets"(sheet1").cells(1,1)=rs.fields(0).vale <----------³o¸Ì¦³°ÝÃD
¦bVBA¸Ìn«ç»òªí¥Ü©O??? |
|
woteil
|
|
|
|
|
- ©«¤l
- 361
- ¥DÃD
- 57
- ºëµØ
- 0
- ¿n¤À
- 426
- ÂI¦W
- 0
- §@·~¨t²Î
- win7
- ³nÅ骩¥»
- 2003,2010
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2010-5-13
- ³Ì«áµn¿ý
- 2022-12-8
|
§Ú¦Û¤v¥H«e³o¼Ë¼g¡A§A°Ñ¦Ò¬Ý¬Ý- sub ex
-
- Set cnn = CreateObject("adodb.connection")
- cnn.Open ("Driver={SQLite3 ODBC Driver};database=" & ThisWorkbook.Path & "\CB.sqlite")'¦Û¦æקïdrive
- Set rss = cnn.Execute("select * from XXX")
- For i = 0 To rss.Fields.Count - 1 '¨ú¼ÐÃD¡A¦pªG¤£n¥i¬Ù²¤
- Cells(1, i + 1) = rss.Fields(i).Name
- Next
- Worksheets("X").Cells(2, 1).CopyFromRecordset (rss) 'cells(2,1)²Ä¤@¦æ¦³¼ÐÃD
- cnn.Close
- Set cnn = Nothing
- Set rss = Nothing
-
- end sub
½Æ»s¥N½X ¦^´_ 4# woteil |
|
|
|
|
|
|
- ©«¤l
- 4
- ¥DÃD
- 2
- ºëµØ
- 0
- ¿n¤À
- 57
- ÂI¦W
- 0
- §@·~¨t²Î
- winxp
- ³nÅ骩¥»
- sp3
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- tainan
- µù¥U®É¶¡
- 2012-8-1
- ³Ì«áµn¿ý
- 2021-12-18
|
¦^´_ 1# woteil
Dim cn
DbName="DB.accdb"
sql_command="select * from baseinfo"
Set cn = CreateObject("adodb.connection")
cn.Open "Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=" & ThisWorkbook.Path & "\" & DbName
Set rs = cn.Execute(sql_command)
'sheets"(sheet1").cells(1,1)=rs.fields(0).value
sheets"(sheet1").cells(1,1).CopyFromRecordset (rs)
cn.Close
§ä¨ì¤@Ó¤èªk..¥i¥H³o»ò°µ
sheets"(sheet1").cells(1,1).CopyFromRecordset (rs)
¦ýÁÙ¬OµLªk¥u¨ú¬YÓÄæªºÈ |
|
woteil
|
|
|
|
|
- ©«¤l
- 4
- ¥DÃD
- 2
- ºëµØ
- 0
- ¿n¤À
- 57
- ÂI¦W
- 0
- §@·~¨t²Î
- winxp
- ³nÅ骩¥»
- sp3
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- tainan
- µù¥U®É¶¡
- 2012-8-1
- ³Ì«áµn¿ý
- 2021-12-18
|
¦^´_ 2# owen06
¤£¦n·N«ä..¬O¥´¿ù..¦ý½T¹ê¦³°ÝÃD
2013³D¦~¥þ¶Ô¼ú³¹
[¹ïwoteil¨Ï¥Îª¯¥J¥d]
1# ¸õÂà¨ì » ˧Ǭݩ«
¥´¦L
¦rÅé¤j¤p: tT
µoªí©ó ¥b¤p®É«e | ¥u¬Ý¸Ó§@ªÌ
«ç»òŪ¨úrecordsetªº¦UÄæ¦ìªºÈ
Dim cn
DbName="DB.accdb"
sql_command="select * from baseinfo"
Set cn = CreateObject("adodb.connection")
cn.Open "Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=" & ThisWorkbook.Path & "\" & DbName
Set rs = cn.Execute(sql_command)
sheets"(sheet1").cells(1,1)=rs.fields(0).value
cn.Close
sheets"(sheet1").cells(1,1)=rs.fields(0).value <----------³o¸Ì¦³°ÝÃD
¦bVBA¸Ìn«ç»òªí¥Ü©O??? |
|
woteil
|
|
|
|
|
- ©«¤l
- 396
- ¥DÃD
- 12
- ºëµØ
- 0
- ¿n¤À
- 425
- ÂI¦W
- 1
- §@·~¨t²Î
- Win10
- ³nÅ骩¥»
- Office 2016
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥x¤¤
- µù¥U®É¶¡
- 2013-7-2
- ³Ì«áµn¿ý
- 2024-8-23
|
¦^´_ 1# woteil
sheets"(sheet1").cells(1,1)=rs.fields(0).vale <----------³o¸Ì¦³°ÝÃD
¬O¦]¬°¥´¿ù¦rªºÃö«Y¶Ü¡Hvalue¡H |
|
|
|
|
|
|