回覆列表
  • 1 # 何以笙丶丶

    Dim i As Integer, j As Integer, sht As Worksheet "i,j為整數變數;sht 為excel工作表物件變數,指向某一工作表

    "Dim cn As New ADODB.Connection "定義資料鏈接物件 ,儲存連線資料庫資訊;請先新增ADO引用

    "Dim rs As New ADODB.Recordset "定義記錄集物件,儲存資料表

    ‘工具 ---〉引用 ---〉Microsoft ActiveX data objects ....

    "下面兩句就不需要增加引用ADO

    Set cn = CreateObject("Adodb.Connection")

    Set rs = CreateObject("Adodb.Recordset")

    Dim strCn As String, strSQL As String "字串變數

    Dim strCond As String

    strCn = "Provider=sqloledb;Server=R9HDET7;Database=dbname;Uid=username;Pwd=password" "定義資料庫連結字串

  • 中秋節和大豐收的關聯?
  • 英雄聯盟怎麼打野?