主题:[讨论]用VB创建一个ACCESS数据库,字段ID自动编号,代码如何写???谢谢.
用VB创建一个ACCESS数据库,字段ID自动编号,代码如何写???谢谢.
是ACCESS数据库,不是SQL的,,百度GOOGLE上都没找到...希望有哪位高手,帮忙下,不胜感激..
Private Sub Command1_Click()
'引用Microsoft ADO Ext 2.8 for DDL and Security
Dim ct As New ADOX.Catalog
Dim tb As New table
ct.Create "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=data_bf.mdb"
tb.Name = "pagenews" '设定新建表的名称
tb.Columns.Append "id", adInteger
tb.Columns.Append "title", 203 '203数据类型:备注
tb.Columns.Append "content", 203 '203数据类型:备注
'设置主键
tb.Keys.Append "PrimaryKey", ADOX.KeyTypeEnum.adKeyPrimary, "id", "", ""
ct.Tables.Append tb '建立数据表
End Sub
baid
是ACCESS数据库,不是SQL的,,百度GOOGLE上都没找到...希望有哪位高手,帮忙下,不胜感激..
Private Sub Command1_Click()
'引用Microsoft ADO Ext 2.8 for DDL and Security
Dim ct As New ADOX.Catalog
Dim tb As New table
ct.Create "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=data_bf.mdb"
tb.Name = "pagenews" '设定新建表的名称
tb.Columns.Append "id", adInteger
tb.Columns.Append "title", 203 '203数据类型:备注
tb.Columns.Append "content", 203 '203数据类型:备注
'设置主键
tb.Keys.Append "PrimaryKey", ADOX.KeyTypeEnum.adKeyPrimary, "id", "", ""
ct.Tables.Append tb '建立数据表
End Sub
baid