BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Variants & CreateOleObject: What I did wrong?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage)
View previous topic :: View next topic  
Author Message
Vladimir Stefanovic
Guest





PostPosted: Sun Jan 25, 2004 3:51 am    Post subject: Variants & CreateOleObject: What I did wrong? Reply with quote



I wanted to get installed ADO version, and asked in '...database.ado' group.

They said:
Quote:
Create new ADODB.Connection object and check its Version property.

I did it but it seems that I missed something. I got compiler error:
'Version' is not a member of Variant. Can you please tell me what
I did wrong?

I posted this to '...database.ado' group, but unfortunatelly the group seems
to
be passive to much.


// My problematic code ...
#include <ComObj.hpp>

// ...
Variant ADO;
float Result;
try
{
ADO = CreateOleObject( "ADODB.Connection" );
Result = StrToFloat( ADO.Version ); // <--------- ERROR
ADO = Unassigned;
}
catch ( ... )
{
Result = 0.0;
}

ShowMessage( FloatToStr( Result ) );






Back to top
Vladimir Stefanovic
Guest





PostPosted: Sun Jan 25, 2004 7:10 am    Post subject: Re: Variants & CreateOleObject: What I did wrong? Reply with quote



Quote:
I posted this to '...database.ado' group, but unfortunatelly the group
seems
to be passive to much.

They confuted me this morning giving the answer :)



Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Sun Jan 25, 2004 7:42 am    Post subject: Re: Variants & CreateOleObject: What I did wrong? Reply with quote




"Vladimir Stefanovic" <spam (AT) not (DOT) needed> wrote


Quote:
Result = StrToFloat( ADO.Version ); // <--------- ERROR

Have a look at the Variant::OlePropertyGet() method, ie (untested):

Result = StrToFloat( ADO.OlePropertyGet("Version") );


Gambit



Back to top
Vladimir Stefanovic
Guest





PostPosted: Sun Jan 25, 2004 9:00 am    Post subject: Re: Variants & CreateOleObject: What I did wrong? Reply with quote

Quote:
Result = StrToFloat( ADO.OlePropertyGet("Version") );

Gambit

Yes, OlePropertyGet() was the functon I needed... But I'm still
confused why Delphi has no such difficulties to access the
properties of Variant (ie OLE). The example I used to represent the
problem works fine with Delphi... But never mind.

Thanks.




Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Sun Jan 25, 2004 11:07 am    Post subject: Re: Variants & CreateOleObject: What I did wrong? Reply with quote


"Vladimir Stefanovic" <spam (AT) not (DOT) needed> wrote


Quote:
But I'm still confused why Delphi has no such
difficulties to access the properties of Variant
(ie OLE).

Probably because the underlying Delphi Pascal language itself has built-in
support for that kind of stuff whereas the C++ language does not.


Gambit



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.