Re: Updating column property on table gives error



Uwe wrote:
When it tries to update the column properties it appears that they
are read only and errors where I marked the code with #######.

Set oRecord = New ADODB.Recordset
oRecord.Open "Select * From [" & oTableSource.Name & "]",
oTableSource.ParentCatalog.ActiveConnection, adOpenForwardOnly
For Each oField In oRecord.Fields
Set colMD = oTableSource.Columns(oField.Name)
With colMD

If Not ExistsColumn(.Name, oTableDest) Then

Set colDB = New ADOX.Column
With colDB
.ParentCatalog = catDest
.Name = colMD.Name
.Type = colMD.Type
.DefinedSize = colMD.DefinedSize
.Attributes = colMD.Attributes

End With
oTableDest.Columns.Append colDB
' *** Now as the column is added, set all it's properties
For i = 0 To colMD.Properties.Count - 1
####### colDB.Properties(i).Value =
colMD.Properties(i).Value

These properties are read/write ONLY UNTIL the column is appended to a
Columns collection, after which they become read-only. See the ADOX
documentation at:
http://msdn.microsoft.com/library/en-us/ado270/htm/mdmscmicrosoftadoprogrammersreference.asp

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


.