ADO field.properties problem
Posted on 2001-12-21
I am writing a VB program that will open an SQL server 2000 table and create a file (string) containing the T-SQL required to create that table.
I've got it to work to an extent, I can get the field names, sizes, types and identies (if any). But I can't seem to get the default value.
I can test this property : rs.Fields(x).Properties("ISAUTOINCREMENT") which tells me whether the field has an identity. But when I test
If rs.Fields(x).Properties("HASDEFAULT") = True Then
I get an item cannot be found in the collection.. error 3265
Why is this? The book I have says that HASDEFAULT is a property of the field.properties object.
I'm using Win 2000, VB 6.0, ADO 2.6, SQL server 2000 and SQLOLEDB provider with open method:
sSQL = "SELECT * FROM " + Form1.txtTableName
Set rs = cn.Execute(sSQL, 2)
Any help would be greatly appreciated.