
Adding / Appending fields to existing table
Hi Marshall,
See the example below excerpted from MDAC 2.5 SDK for how to append a column
to a table.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
Columns and Tables Append Methods, Name Property Example (VB)
The following code demonstrates how to create a new table.
Sub 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:\Program Files\Microsoft Office\" & _
"Office\Samples\Northwind.mdb;"
tbl.Name = "MyTable"
tbl.Columns.Append "Column1", adInteger
tbl.Columns.Append "Column2", adInteger
tbl.Columns.Append "Column3", adVarWChar, 50
cat.Tables.Append tbl
End Sub
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ling
Quote:
> I have an exisiting table and would like to add functionality that would
> give the user the capability to add a new field to the table. Is this
easily
> done using the ADO Append method?
> Does anyone have some sample code, they could share?
> Regards
> Marshall Brown