#import "H:\\Program Files\\Common Files\\System\\ado\\msado15.dll" no_namespace rename("EOF", "EndOfFile")
int main(int argc, char* argv[])
{
CoInitialize(NULL);
try
{
_ConnectionPtr pConn("ADODB.Connection");
_RecordsetPtr pRst("ADODB.Recordset");
pConn->Open("Provider=sqloledb;Data Source=Server1;"
"Initial Catalog=test1;User Id=sa;Password=sa;",
"", "", adConnectUnspecified);
// Note 1.
pRst->Open(
"userinfo",
_variant_t((IDispatch *) pConn, true),
adOpenStatic,
adLockReadOnly,
adCmdTable);
pRst->MoveLast();
// Note 2.
printf("Last name is '%s %s'\n",
(char*) ((_bstr_t) pRst->GetFields()->GetItem("username")->GetValue()),
(char*) ((_bstr_t) pRst->Fields->Item["otherinfo"]->Value));
pRst->Close();
pConn->Close();
}
catch (_com_error &e)
{
printf("Description = '%s'\n", (char*) e.Description());
}
::CoUninitialize();
return 0;
}
int main(int argc, char* argv[])
{
CoInitialize(NULL);
try
{
_ConnectionPtr pConn("ADODB.Connection");
_RecordsetPtr pRst("ADODB.Recordset");
pConn->Open("Provider=sqloledb;Data Source=Server1;"
"Initial Catalog=test1;User Id=sa;Password=sa;",
"", "", adConnectUnspecified);
// Note 1.
pRst->Open(
"userinfo",
_variant_t((IDispatch *) pConn, true),
adOpenStatic,
adLockReadOnly,
adCmdTable);
pRst->MoveLast();
// Note 2.
printf("Last name is '%s %s'\n",
(char*) ((_bstr_t) pRst->GetFields()->GetItem("username")->GetValue()),
(char*) ((_bstr_t) pRst->Fields->Item["otherinfo"]->Value));
pRst->Close();
pConn->Close();
}
catch (_com_error &e)
{
printf("Description = '%s'\n", (char*) e.Description());
}
::CoUninitialize();
return 0;
}
我先谢了;
此方法可行;
有没有方法知道msado15.dll的内部结构;
我还在书上看见msado21.til;
它与msado15.dll的区别在哪里?