Article ID: 175383
Article Last Modified on 7/13/2004
[in, out] VARIANT * returnval
In this specific example, this argument is not necessary except to
demonstrate how you might return data to the client.
#import "C:\Program Files\Common Files\SYSTEM\ADO\MSADO15.DLL" no_namespace rename("EOF", "adoEOF" )
If you plan to reference ADO Objects as arguments to a method that is
declared in ADOComponent.h, you must move the #import directive to that header
file.
/D "_ATL_MIN_CRT"
C++ exception handling is required by ATL smart pointers.
m_spObjectContext->Release();
Replace this code with the following line:
m_spObjectContext.Release();
_RecordsetPtr adoRs = NULL;
try
{
_variant_t InVar;
adoRs.CreateInstance(__uuidof(Recordset));
adoRs->Open( "select au_fname from authors where "
"au_lname = 'White'",
"DSN=PUBS;UID=<username>;PWD=<strong password>;",
adOpenForwardOnly, adLockReadOnly, adCmdText );
InVar = adoRs->Fields->GetItem("au_fname")->Value;
VariantClear(returnval);
VariantCopy(returnval, &(InVar.Detach()));
adoRs->Close();
}
catch(_com_error)
{
if(adoRs)
{
adoRs->Close();
adoRs = NULL;
}
m_spObjectContext->SetAbort();
return z.Error();
}
m_spObjectContext->SetComplete();
return S_OK;
http://support.microsoft.com
http://www.microsoft.com/transaction/
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/adostartpage1.asp
167802 SAMPLE: EXCEPTEX Traps MFC and Win32 Structured Exceptions
Keywords: kbhowto kbdatabase kbpending KB175383