tags:

views:

159

answers:

2

This is the sql script I used to create a table in MS Access Database.

CREATE TABLE Contracts (
id int  NULL DEFAULT 0,
sex varchar(255) DEFAULT 'female' NOT NULL
)

Now I want to programmatically get the default value of the field: "sex", I know it's 'female' but I don't know how to get it using C++ ADO interface.

Below is a snippet of my code:

m_pRecordset->Fields->get_Item(vIntegerType, &pvObject);
bstrColName = pvObject->GetName();
dtype = pvObject->GetType();
attr = pvObject->GetAttributes();
A: 

I can give you idea how to achieve it..

GetAttributes() method will not give you default value of the field but it will give you info about whether field is autoincrement ,system field or fixed - variable size field.

Check out for method GetDefaultValue() of the field that will do what you want.

Ashish
Hi, Fields has no **GetDefaultValue()** method at all.
A: 

use ADOX

Sheng Jiang 蒋晟