Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: Using ADOX to set Default for column in SQLServer


Message #1 by "Mark Everest" <mark.everest@t...> on Mon, 23 Oct 2000 11:27:57 +0100
I am using ADOX (on Windows 2000) to create a new table in my database.

One of the columns must have a default for each new record so I wish to
populate the default dynamic property.

However, I cannot do this because when I try to set the value of the
default property I am told the data type is wrong (it is expecting
adVariant) - I have tried casting it using CVar etc.


Please can anyone help.  Code follows.....



Set adoxCatalog.ActiveConnection = ADOCon
Set adoxTable = New adox.Table
adoxTable.Name = "MyNewTable"

Set adoxCol = New adox.Column
Set adoxCol.ParentCatalog = adoxCatalog
        
adoxCol.Name = "MyNewColumn"
adoxCol.Type = adInteger
adoxCol.Attributes = adColFixed
adoxCol.Properties("Default").Value = 0   ' this line fails
adoxTable.Columns.Append adoxCol


  Return to Index