欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
如何使用 ADOX 通過(guò)主鍵創(chuàng )建表

創(chuàng )建示例應用程序的步驟

  1. 在 Microsoft Visual Basic 5.0 或 6.0 中創(chuàng )建一個(gè)新的標準 EXE 項目。默認情況下創(chuàng )建 Form1。
  2. 項目 菜單上選擇要添加以下類(lèi)型庫的 引用
    Microsoft ActiveX 數據對象 2.1 庫
    Microsoft ADO 分機 2.1 DDL 和安全
  3. 在 Form1 中添加兩個(gè) 命令 按鈕 (Command1 和 Command2) 和下面的代碼:
    Option Explicit

    Private Sub Command1_Click()
    '
    ' This code adds a single-field Primary key
    '
    Dim Cn As ADODB.Connection, Cat As ADOX.Catalog, objTable As ADOX.Table

    Set Cn = New ADODB.Connection
    Set Cat = New ADOX.Catalog
    Set objTable = New ADOX.Table

    'Open the connection
    Cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=biblio.mdb"

    'Open the Catalog
    Set Cat.ActiveConnection = Cn

    'Create the table
    objTable.Name = "Test_Table"

    'Create and Append a new field to the "Test_Table" Columns Collection
    objTable.Columns.Append "PrimaryKey_Field", adInteger

    'Create and Append a new key. Note that we are merely passing
    'the "PimaryKey_Field" column as the source of the primary key. This
    'new Key will be Appended to the Keys Collection of "Test_Table"
    objTable.Keys.Append "PrimaryKey", adKeyPrimary, "PrimaryKey_Field"

    'Append the newly created table to the Tables Collection
    Cat.Tables.Append objTable

    ' clean up objects
    Set objKey = Nothing
    Set objTable = Nothing
    Set Cat = Nothing
    Cn.Close
    Set Cn = Nothing
    End Sub

    Private Sub Command2_Click()
    '
    ' This code adds a multi-field Primary Key
    '
    Dim Cn As ADODB.Connection, Cat As ADOX.Catalog
    Dim objTable As ADOX.Table, objKey As ADOX.Key

    Set Cn = New ADODB.Connection
    Set Cat = New ADOX.Catalog
    Set objTable = New ADOX.Table
    Set objKey = New ADOX.Key

    Cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=biblio.mdb"
    Set Cat.ActiveConnection = Cn
    objTable.Name = "Test_Table2"

    objTable.Columns.Append "PrimaryKey_Field1", adInteger
    objTable.Columns.Append "PrimaryKey_Field2", adInteger

    objKey.Name = "PrimaryKey"
    objKey.Type = adKeyPrimary
    objKey.Columns.Append "PrimaryKey_Field1"
    objKey.Columns.Append "PrimaryKey_Field2"

    objTable.Keys.Append objKey

    Cat.Tables.Append objTable

    ' clean up objects
    Set objKey = Nothing
    Set objTable = Nothing
    Set Cat = Nothing
    Cn.Close
    Set Cn = Nothing
    End Sub
    : 您可能需要調整指向有效的 Jet 數據庫連接字符串。
  4. 運行該應用程序,然后單擊 命令 按鈕。您可以檢查 Test_Table 和 TestTable2 Microsoft Access 97、 Microsoft Access 2000,或 Visual Basic 可視化數據管理器加載項中的對表定義。

本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
ASP創(chuàng )建數據庫,新建數據表、字段
用ADOX在磁盤(pán)上新建一個(gè)mdb文件
C# 動(dòng)態(tài)創(chuàng )建Access數據庫及表
用VB動(dòng)態(tài)創(chuàng )建Access數據庫簡(jiǎn)例
C#程序中:access數據庫中如何新建數據表
VBA數據庫解決方案第11講,如何動(dòng)態(tài)建立數據庫和數據庫表
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久