| View previous topic :: View next topic |
| Author |
Message |
Vladimir Stefanovic Guest
|
Posted: Sun Jan 25, 2004 3:51 am Post subject: Variants & CreateOleObject: What I did wrong? |
|
|
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
|
Posted: Sun Jan 25, 2004 7:10 am Post subject: Re: Variants & CreateOleObject: What I did wrong? |
|
|
| 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
|
Posted: Sun Jan 25, 2004 7:42 am Post subject: Re: Variants & CreateOleObject: What I did wrong? |
|
|
"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
|
Posted: Sun Jan 25, 2004 9:00 am Post subject: Re: Variants & CreateOleObject: What I did wrong? |
|
|
| 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
|
Posted: Sun Jan 25, 2004 11:07 am Post subject: Re: Variants & CreateOleObject: What I did wrong? |
|
|
"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 |
|
 |
|