Article View: borland.public.cppbuilder.database.ado
Article #4645ADO Error
From: Dale
Date: Tue, 23 Oct 2001 14:27
Date: Tue, 23 Oct 2001 14:27
111 lines
3308 bytes
3308 bytes
always get "Crash" msgbox.
The ADO Error I get is Arguments are of teh wrong type, Are out of
acceptable range, or are in clonflict with one another.
What am I doing wrong?
HRESULT clsCommand::Execute(_Recordset** pRS,int* iRetVal)
{
HRESULT hr;
if ( m_Command == NULL) // should not be null here
{
throw Exception ("m_Command == NULL");
}
VARIANT vNull;
vNull.vt = VT_ERROR;
vNull.scode = DISP_E_PARAMNOTFOUND;
m_Command->putref_ActiveConnection(m_Connection);
m_Command->put_CommandType(adCmdStoredProc);
VARIANT var;
var.vt = VT_UNKNOWN;
var.punkVal = m_Command;
// create a recordset
hr = CoCreateInstance( CLSID_CADORecordset,
NULL,
CLSCTX_INPROC_SERVER,
IID_IADORecordset,
(LPVOID *) pRS);
if( FAILED( hr ) )
{
return hr;
}
(*pRS)->put_CursorLocation(adUseClient);
// Run the command and grab any returned recordset
hr =
*pRS)->Open( var,vNull,adOpenForwardOnly,adLockBatchOptimistic,adCmdStoredPr
oc);
// hr = m_Command->Execute(NULL,NULL,adCmdStoredProc,pRS);
if( FAILED( hr ) )
{
// catch errors I like. :)
CatchCMDError( iRetVal );
return E_FAIL;
}
VARIANT varNULL;
var.vt = VT_NULL;
var.lVal = NULL;
hr =(*pRS)-> put_ActiveConnection (varNULL);
if (FAILED(hr))
{
ShowMessage("Crash ");
}
return hr;
}
"Eric Garza" <egarza@amige.NOSPAM.com> wrote in message
news:umv8SI0WBHA.2256@tkmsftngp03...
> Dale,
>
> You need to disconnect the RS after the Open:
>
> oRS.Open oCmd
> Set oRS.ActiveConnection = Nothing
> ' Don't close the recordset!!
> oConn.Close
> ...
>
> --
> Regards,
> Eric Garza, MVP
> Project manager
> AMI GE
>
>
> "Dale" <Dkrebbers@cenadex.com> wrote in message
> news:ejiry3zWBHA.1380@tkmsftngp03...
> > I have a procedure which I call to return a recordset. I pass in a
> recordset
> > pointer. I create a Command object and a Connection object I then set
the
> > connection property to the connection object. I then create a recordset
> then
> > call open with the command object. I then retrun the recordset. If I
> release
> > and set the command and connection the recordset is destroyed.
> >
> > what am I doing wrong?
> >
> >
> >
> > thanks
> >
> >
> >
> > Dale
> >
> >
> >
>
>
Technical Details
Message-ID:
<3bd57e5e_1@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!howland.erols.net!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnewsShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,813b5ae544a1f3b1 X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2001-10-23 07:31:15 PST From: "Dale" <Dkrebbers@cenadex.com> Newsgroups: borland.public.cppbuilder.database.ado Subject: ADO Error Date: Tue, 23 Oct 2001 07:27:23 -0700 Lines: 115 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 NNTP-Posting-Host: 24.67.186.198 Message-ID: <3bd57e5e_1@dnews> X-Trace: dnews 1003847262 24.67.186.198 (23 Oct 2001 07:27:42 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!howland.erols.net!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews