Retriving Column Names of a table
-
Hi to All, I have a problem in VC++. Im using ado object for database application. Is there any method exists in _RecordsetPtr to reteive all Column_Names and Data_types of columns(Fields). I have tried a lot,but failed. plz suggest me..... Thanks a lot in advance Nagaraju
-
Hi to All, I have a problem in VC++. Im using ado object for database application. Is there any method exists in _RecordsetPtr to reteive all Column_Names and Data_types of columns(Fields). I have tried a lot,but failed. plz suggest me..... Thanks a lot in advance Nagaraju
This might work, assuming recordset is a _RecordsetPtr:
ADODB::FieldPtr field; CString name; int type; for (int i = 0; i < recordset->Fields->GetCount(); i++ ) { field = recordset->Fields->GetItem(COleVariant(i)); if (field) { name = field->GetName(); type = field->GetType(); // do what you need to do } }
- S 50 cups of coffee and you know it's on!
-
Hi to All, I have a problem in VC++. Im using ado object for database application. Is there any method exists in _RecordsetPtr to reteive all Column_Names and Data_types of columns(Fields). I have tried a lot,but failed. plz suggest me..... Thanks a lot in advance Nagaraju
ADO wrapper class
C_Recordset
has methodGetFields
,which returnsCFields
. Use this class for information you required.Prasad Notifier using ATL | Operator new[],delete[][^]