Microsoft ADO Ext.2.7 for DDL ado Security'建数据库:Private Sub Form_Load() Di">
Microsoft ADO Ext.2.7 for DDL ado Security'建数据库:Private Sub Form_Load() Di" />
1、怎样用VB的代码创建Access数据库用 ADOX:'菜单“工程”-->"引用"-->Microsoft ADO Ext.2.7 for DDL ado Security'建数据库:Private Sub Form_Load() Dim cat As ADOX.Catalog Set cat = New ADOX.Catalog '在当前目录下建立名为newdata的Access数据库 cat.Create ("Provider=Microsoft.Jet.OLEDB.4.0;D
2、ata Source=" + App.Path & "ewdata.mdb" + ";") MsgBox "数据库已经创建成功!"End Sub'建表:Private Sub Command1_Click() Dim cn As New ADODB.Connection cn.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "newdata.mdb;Persist Secur
3、ity Info=False" cn.Open cn.Execute "CREATE TABLE [aaa]([学生姓名]Text(20),[年龄]Integer,[成绩]Double)" cn.CloseEnd Sub'删表:Private Sub Command2_Click() Dim cn As New ADODB.Connection cn.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source
5、////////////////////////Option ExplicitDim i As IntegerDim j As IntegerPrivate Sub Form_Load()'菜单“工程”-->"引用"-->"Microsoft ActiveX Data Objects 2.7 Library"'Microsoft ADO Ext.2.7 for DDL ado Security Dim cat As ADOX.Catalog Set cat = New ADOX.Catalogcat.C
6、reate ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:ewdata.mdb" + ";")MsgBox "数据库已经创建成功!"Dim tbl As ADOX.TableSet tbl = New ADOX.Tabletbl.ParentCatalog = cattbl.Name = "MyTable"'增加一个自动增长的字段Dim col As ADOX.ColumnSet col = New ADOX.Columncol.ParentCat