Hurry ! ! ! Another line waiting ! !

Category: VC/MFC -> Database Author: wode70656 Date: 2014-07-25 19:54:09
 
wode70656
2014-07-25 19:54:09
Why the following code to the movelast   out of the exception ? To get the field value of the last record , in what ways ?
USES_CONVERSION;
:: CoInitialize (NULL);
_ConnectionPtr   con (__ uuidof (Connection));
_RecordsetPtr   rst (__ uuidof (Recordset));
con - > ConnectionString = " File   Name = E: \\ connectString.udl ";
try
{
    con- > Open (" ", " ", _ bstr_t (" "), - 1);
}
catch (_com_error   & e)
{
con = NULL;
MessageBox (NULL, " not open database ", " warning ", MB_OK);
return;
}
_variant_t   RecordsAffected;
con- > Execute ( " create   table   ... ");

rst- > Open (" select   *   from   user ", _ variant_t ((IDispatch *) con, true), adOpenStatic, adLockOptimistic, adCmdText);
HRESULT   hresult;
int     rc;
hresult = rst- > MoveLast ();
rc = rst- > GetRecordCount ();
g657234996
2014-07-25 19:59:37
if   (rst- >! adoEoF)
{
int     rc;
hresult = rst- > MoveLast ();
}
huangiwaner111
2014-07-25 20:18:21
there are thousands of records in the USER table as well? How rst- > adoEOF  ? For true