Article ID: 201716
Article Last Modified on 8/23/2001
Catalog.Tables.Append tblagainst SQL Server may generate the following error:
Microsoft ActiveX Data Objects Microsoft ADO Ext. for DDL and Security
Dim tbl As New ADOX.Table
Dim cn As New ADODB.Connection
Dim cl As New ADOX.Column
Dim cat As New ADOX.Catalog
'Open Connection to Data Source
With cn
.ConnectionString = "PROVIDER=sqloledb;DATA SOURCE=<your_server;USER ID=<uid>;PASSWORD=<pwd>;INITIAL CATALOG=pubs"
.Open
End With
'Associate the Catalog object to the Connection.
With cat
.ActiveConnection = cn
End With
'Create a table definition.
With tbl
.Name = "MyADOXtbl"
End With
'Create a Column definition.
With cl
.Name = "Col1"
.DefinedSize = 10
.Type = adChar
.Attributes = adColFixed + adColNullable
End With
'Add the Column definition to the table table definition.
tbl.Columns.Append cl
'Create the table on the Data Source
cat.Tables.Append tbl
Keywords: kbdatabase kbprb KB201716