Dim ADOXcatalog As New ADOX.Catalog
Dim ADOXtable As ADOX.Table
Dim ADOXindex As ADOX.Index
Dim ADOXkey As ADOX.Key
Dim ADOXQuery As ADODB.Command
Try
Dim mdbCN As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=NomeDatabase.mdb;Jet OLEDB:Engine Type=5;Jet OLEDB:System database='system.mdw';"
'***Creazione database
ADOXcatalog.Create(mdbCN)
'***Creazione tabella
ADOXtable = New ADOX.Table
ADOXtable.Name = "Tabella1"
ADOXtable.Columns.Append("Id", ADOX.DataTypeEnum.adInteger)
ADOXtable.Columns.Append("Descrizione", ADOX.DataTypeEnum.adVarWChar, 50)
ADOXtable.Columns.Append("Data", ADOX.DataTypeEnum.adDate)
ADOXcatalog.Tables.Append(ADOXtable)
'***Creazione Query1
ADOXQuery = New ADODB.Command
ADOXQuery.CommandText = "SELECT TOP 5 Tabella1.Descrizione FROM Tabella1 ORDER BY Tabella1.Descrizione ASC"
ADOXcatalog.Views.Append("Query1", ADOXQuery)
Catch ex As Exception
Response.Write(ex.Message)
End Try
ADOXcatalog.ActiveConnection.Close()
ADOXtable = Nothing
ADOXindex = Nothing
ADOXcatalog = Nothing