Article View: borland.public.cppbuilder.database.ado
Article #869Re: Import ADO type library
From: Angel
Date: Mon, 04 Jul 2005 11:24
Date: Mon, 04 Jul 2005 11:24
77 lines
3233 bytes
3233 bytes
I forgot to say that the connection is opened correctly (forgot to put
the line in the sample code that I posted), and that I have trouble only
with the Command object. The Recordset object has worked fine for me in
other functions.
When I execute the command, after I have modified the CommandText
property, it is always empty (the commandtext property) and I get an
error (0x80040E0C-Empty commandtext) when I execute the command .
Thanks again.
Angel wrote:
> Hello to all.
>
> (BCB6 Enterprise)
>
> I have imported the Microsoft ActiveX Data Objects 2.8 Library, because
> i have to make an application that doesn't use ADOExpress.
>
> I use the imported objects in this function:
>
> HRESULT __fastcall ADODatabase::ExecuteCmd(wchar_t* CmdStr,VARIANT*
> pParams)
> {
> HRESULT hr = -1;
> ConnectionPtr DBConn;
> CommandPtr DBCommand;
> RecordsetPtr RecTemp;
>
> try
> {
> hr=DBConn.CreateInstance(CLSID_Connection);
> if(SUCCEEDED(hr))
> {
> RecTemp.CreateInstance(CLSID_Recordset);
> hr = pDBCommand.CreateInstance(CLSID_Command);
> if(SUCCEEDED(hr))
> {
> DBCommand->CommandText = CmdStr;
> DBCommand->ActiveConnection = DBConn;
> RecTemp = DBCommand->Execute( TVariantInParam(1),
> Params,
> adCmdText);
> }
>
> }
> }
>
> catch(...)
> {
> hr = -1;
> }
> return hr;
> }
>
> but I always get a compiling error ('CommandText is not accessible').
>
> I have edited the ADODB_TLB.h file, changing the lines where the
> property CommandText is defined to define the write part of the property
> in this way:
>
> __property BSTR CommandText = {read = get_CommandText};
> //original line
> __property BSTR CommandText = {read = get_CommandText
> write = put_CommandText}; //Line modified by me
>
> but I cannot get the command to work
>
> I think that Tlibimp is buggy, and also is the Import type library
> option of the menu.
>
> Any suggestion? I repeat that i cannot use ADOExpress.
>
> Thanks in advance.
Technical Details
Message-ID:
<42c91c7d$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news.germany.com!newsfeed.utanet.at!newsfeed.inode.at!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<42c91228$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,edb9422f973acd68 X-Google-Attributes: gid10698b,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Mon, 04 Jul 2005 13:24:04 +0200 From: Angel <user@example.net> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.7) Gecko/20050414 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.database.ado Subject: Re: Import ADO type library References: <42c91228$1@newsgroups.borland.com> In-Reply-To: <42c91228$1@newsgroups.borland.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 213.37.37.240 Message-ID: <42c91c7d$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1120476285 213.37.37.240 (4 Jul 2005 04:24:45 -0700) Lines: 77 Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news.germany.com!newsfeed.utanet.at!newsfeed.inode.at!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail