• 2

excel vba樞紐分析表與資料庫

這是我寫的程式碼
記憶體的方式
我不知要如何寫
麻煩了,謝謝
Dim cn As New ADODB.Connection
cn.ConnectionString = "Provider=SQLOLEDB;Network Library=DBMSSOCN;Data Source=192.168.10.123,1433;Initial Catalog=Mo;User Id=sa;Password=123"
cn.Open

Dim Rs As New ADODB.Recordset
Rs.Open "SELECT * FROM asds", cn

Dim row As Integer, col As Integer
row = 1
For col = 1 To Rs.Fields.Count
Cells(row, col) = Rs.Fields(col - 1).Name
Next col
Do Until Rs.EOF
For col = 1 To Rs.Fields.Count
Cells(row + 1, col) = Rs.Fields(col - 1).Value
Next col
Rs.MoveNext
row = row + 1
Loop
Rs.Close
cn.Close
Set Rs = Nothing
Set cn = Nothing
  • 2
內文搜尋
X
評分
評分
複製連結
Mobile01提醒您
您目前瀏覽的是行動版網頁
是否切換到電腦版網頁呢?