Dim cat
Dim tbl
Dim con
Dim tableExists
Dim colExists
tableExists=False
colExists = False
on error goto 0
Set cat = server.createobject("ADOX.Catalog")
Set cat.ActiveConnection = cmdDC
Set tbl = cat.Tables.Item("tblmailList")
With tbl
response.Write "----- Column count 1 " & .Columns.Count & "<br>" & vbcrlf
For intCount1 = 0 To .Columns.Count - 1
if .Columns.Item(intCount1).name = lcase("unsubscribe") then
colExists = true
exit for
end if
response.write "Cols " & .Columns.Item(intCount1) & "<br>" & vbcrlf
Next
if colExists then
'** do nothing except display message, already present
response.write "column unsubscribe already exists<BR>" & vbcrlf
else
response.write "about to add column unsubscribe<BR>" & vbcrlf
on error resume next
.Columns.add "unsubscribe", 11
if err.number > 0 then
response.Write err.number & " " & err.Description & "<br>"
else
response.write "column unsubscribe added<BR>" & vbcrlf
end if
end if
Debug.Print "------- Column count 2 " & .Columns.Count & vbcrlf
For intCount1 = 0 To .Columns.Count - 1
resonse.write "cols " & .Columns.Item(intCount1) & "<br>" & vbcrlf
Next
End With
response.Write "All done update " & "<br>" & vbcrlf
'Clean up the references
Set cat = Nothing
Set tbl = Nothing
Set tbl = Nothing
End If
Set cat = Nothing
Set con = Nothing