请教高手 如何动态创建表access表

解决方案 »

  1.   

    strsql = "create table tbl" & cboType.Text & _             "([文件名] Text(50),[文件大小] Text(50),[文件日期] data(30))"
      

  2.   

    Set rs = New ADODB.Recordset   rs.CursorType = adOpenKeyset   rs.LockType = adLockOptimistic   rs.Open "select * into " + newtablename + " from system where false", cnn, , , adCmdText其中newtablename为新表的名称,system为已存在的的一个表,cnn为你的数据库连接语句!
      

  3.   

    cn.execute "create table test(a int,b varchar(20))"
      

  4.   

    '引用微软 ADO Ext.2.7 for dll and Security
    '创建数据库和数据表及字段Private Sub Command1_Click()
        CreateDatabase
        CreateTable
        MsgBox "成功"
    End Sub
    Sub CreateDatabase()
       Dim cat As New ADOX.Catalog
       cat.Create "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\new.mdb"
    End SubSub CreateTable()
       Dim tbl As New Table
       Dim cat As New ADOX.Catalog
    'Open the catalog.
       ' Open the Catalog.
       cat.ActiveConnection = _
          "Provider=Microsoft.Jet.OLEDB.4.0;" & _
          "Data Source=c:\new.mdb;"   tbl.name = "MyTable"
       tbl.Columns.Append "Column1", adInteger
       tbl.Columns.Append "Column2", adInteger
       tbl.Columns.Append "Column3", adVarWChar, 50
       cat.Tables.Append tblEnd Sub