Laiyiling (the most familiar stranger) (knowing too little, a lot of questions will not!) Post it is in the community.
This is a list of fields based on the table, you refer to:
#include
#define Pause Printf ("/ npress any key to exit"); getch ();
#define _win32_dcom
#pragma Warning (Push)
#pragma Warning (Disable: 4146)
#import "E: / Program Files / Common Files / System / ADO / MSADO15.DLL" No_Namespace Rename ("EOF", "ENDOFFILE")
#pragma Warning (POP)
Int main (int Argc, char * argv [])
{
_CONNECTIONPTR M_PCONN;
_RecordSetPtr M_PRS;
Coinitializeex (NULL, COINIT_MULTITHREADED);
_BSTR_T BSTRCONNSTR = "provider = microsoft.jet.Oledb.4.0;"
"Data Source = f: //lylong//db1.mdb; Persist security info = false";
Try {
m_pconn.createInstance (__UUIDOF (Connection));
M_PRS.CREATEINSTANCE (__UUIDOF (Recordset));
M_PCONN-> Open (BSTRCONNSTR, "," "", adConnectunSpecified;
M_PRS-> Open ("Table1",
m_pconn.getInterfacePtr (), AdopenForwardonly, AdlockOptimistic, Adcmdtable;
Long lcolumn = m_prs-> fields-> count;
Printf ("% - 12S% -10s% -10s / n", "field name", "length", "type");
For (long i = 0; i { Printf ("% - 12S% -10D% -10d / n", (char *) m_prs-> fields-> item [i] -> name, M_PRS-> Fields-> item [i] -> definedsize, M_PRS-> Fields-> Item [i] -> type); } M_PRS-> Close (); M_PCONN-> Close (); } catch (_COM_ERROR E) { Printf ("/ n% s error:% ld / r / n" "% s / r / n" "% s / r / n", (char *) E.Source (), E.Error (), (char *) E.DESCRIPTION (), (char *) E.ERRORMESSAGE ()); M_PRS-> Close (); M_PCONN-> Close (); } Couninitialize (); Pause; Return 0; }