Platform : VisualC++, Windows XP , VisualStudio2005

Hello,

We need to provide OLEDB functionality in our application. In order to
provide certain generalisation we need our oledb classes to be multiply
inherited from one of our abstract base classes as well.
Following is the kind of coding done.

1) class CABSSet //Our application's Abstract base class

2) template <class TAccessor, template <typename T> class TRowset = CRowset>
class CABSOleDbSet : public CABSSet, public CCommand<TAccessor,
TRowset>//Our OLEDB abstract base class

3) class CMyBaseSet //Abstract base class for the MyTable

4) For every new derived oledb class for the database tables we plan to do

class CMyOleDBSet: public CMyBaseSet,

public
CABSOleDbSet<CAccessor<CMyOleDbAccessor>, CRowset >





1) Is there any known problem w.r.t multiple inheritance in the above
fashion when needing use oledb interfaces of CCommand in the derived class
CMyOleDBSet especially related to the rowsets fetched?



2) In general is there any known issue in multiple inheriting from a
template and a simple class as specified above?



Thanks and Regards

Ganga

Re: Any problems expected in Multiple inheritance with template class ? by Igor

Igor
Wed Jul 09 08:11:04 CDT 2008

"Ganga Sridhar" <gangasridhar@abosoftware.com> wrote in message
news:uJpkwOc4IHA.3796@TK2MSFTNGP03.phx.gbl
> 1) Is there any known problem w.r.t multiple inheritance in the above
> fashion when needing use oledb interfaces of CCommand in the derived
> class CMyOleDBSet especially related to the rowsets fetched?

None that I know of. Do you encounter some problems?

> 2) In general is there any known issue in multiple inheriting from a
> template and a simple class as specified above?

Again, none that I know of. ATL does it left and right.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925



Re: Any problems expected in Multiple inheritance with template class ? by Ganga

Ganga
Thu Jul 10 09:30:18 CDT 2008

Thanks this is the problem we are facing:

Platform: Visual Studio 2005, Window 2003 server,Database - MS Access
2003,Technology - OleDB

We have developed database application which uses OleDB. I have derived a
class CABIOleDBSet from CCommand which works fine as code given below
template <class TAccessor, template <typename T> class TRowset =CRowset>
class CABIOleDbSet : public CCommand<TAccessor, TRowset>

{
...
}

When I use multiple inheritance i.e derived class CABIOleDBSet from CCommand
and CTest program crashes. Class CTest have virtual function TestFunc().

class CTest
{

public:

virtual void TestFunc() {}

};

template <class TAccessor, template <typename T> class TRowset =CRowset>

class CABIOleDbSet : public CCommand<TAccessor, TRowset>, public CTest

{

...

...

}

Above example works fine if CTest class do not have any virtual function

like

class CTest

{

public:

void TestFunc() {}

};

However the application crashes when we use multiple inheritance
i.e. derived class CABIOleDBSet from CCommand and CTest and CTest have a
virtual function.

Any idea what could be the problem?

Thanks and Regards,

Ganga







"Igor Tandetnik" <itandetnik@mvps.org> wrote in message
news:e%23g0$Uc4IHA.2348@TK2MSFTNGP06.phx.gbl...
> "Ganga Sridhar" <gangasridhar@abosoftware.com> wrote in message
> news:uJpkwOc4IHA.3796@TK2MSFTNGP03.phx.gbl
>> 1) Is there any known problem w.r.t multiple inheritance in the above
>> fashion when needing use oledb interfaces of CCommand in the derived
>> class CMyOleDBSet especially related to the rowsets fetched?
>
> None that I know of. Do you encounter some problems?
>
>> 2) In general is there any known issue in multiple inheriting from a
>> template and a simple class as specified above?
>
> Again, none that I know of. ATL does it left and right.
> --
> With best wishes,
> Igor Tandetnik
>
> With sufficient thrust, pigs fly just fine. However, this is not
> necessarily a good idea. It is hard to be sure where they are going to
> land, and it could be dangerous sitting under them as they fly
> overhead. -- RFC 1925
>



Re: Any problems expected in Multiple inheritance with template class ? by Igor

Igor
Thu Jul 10 11:51:04 CDT 2008

"Ganga Sridhar" <gangasridhar@abosoftware.com> wrote in message
news:egVe9lp4IHA.5060@TK2MSFTNGP02.phx.gbl
> When I use multiple inheritance i.e derived class CABIOleDBSet from
> CCommand and CTest program crashes.

Crashes when doing what? I seem to have misplaced by crysal ball.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925



Re: Any problems expected in Multiple inheritance with template class ? by Ganga

Ganga
Thu Jul 10 13:36:45 CDT 2008

This is a multi-part message in MIME format.

------=_NextPart_000_016C_01C8E2EA.024AF2B0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Sorry for the incomplete mail:

I have my derived class=20

CABIOleDbSet : public CCommand<TAccessor, TRowset>, public CABISet

{
...
}


In CABISet I have a function like this=20

class CABISet=20

{

.........

virtual void Open(const string& strSQL) =3D 0;

}

HRESULT CABIOleDbSet::OpenWithException(CABIOleDbSession& session, const =
string& strCmd, DBPROPSET *pPropSet)

{

if(session.IsOpen()=3D=3Dfalse)

{

ostringstream ost;=20

ost << "Session is not opened. Can'nt execute command [" << strCmd << =
"]";

throw CMyException(CONNECTION_ERROR, ost.str(), __FILE__, __LINE__);

}

wstring wstrCmd =3D StrToWstr(strCmd);

HRESULT hr =3D S_FALSE;


try

{

hr =3DCCommand::Open(*m_pSession, wstrCmd.c_str(), pPropSet);//CRASHES =
here

}

catch(...)

{

ASSERT(false);

}

return hr;

}

Any idea why?

Thanks and Regards

Ganga

"Igor Tandetnik" <itandetnik@mvps.org> wrote in message =
news:O6FGn0q4IHA.3484@TK2MSFTNGP05.phx.gbl...
> "Ganga Sridhar" <gangasridhar@abosoftware.com> wrote in message
> news:egVe9lp4IHA.5060@TK2MSFTNGP02.phx.gbl
>> When I use multiple inheritance i.e derived class CABIOleDBSet from
>> CCommand and CTest program crashes.
>=20
> Crashes when doing what? I seem to have misplaced by crysal ball.
> --=20
> With best wishes,
> Igor Tandetnik
>=20
> With sufficient thrust, pigs fly just fine. However, this is not=20
> necessarily a good idea. It is hard to be sure where they are going to =

> land, and it could be dangerous sitting under them as they fly=20
> overhead. -- RFC 1925=20
>=20
>
------=_NextPart_000_016C_01C8E2EA.024AF2B0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.6000.16674" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV>
<P><FONT face=3DArial size=3D2>Sorry for the incomplete mail:</FONT></P>
<P><FONT face=3DArial size=3D2>I have my derived class<FONT size=3D3>=20
</FONT></FONT></P>
<P><FONT face=3DArial><FONT size=3D2><STRONG>CABIOleDbSet : public=20
CCommand&lt;TAccessor, TRowset&gt;, public=20
CABISet<BR></STRONG><BR>{<BR>...<BR>}<BR></FONT></P></FONT>
<P><FONT face=3DArial size=3D2>In CABISet I have a function like this=20
</FONT></P><FONT face=3DArial size=3D2><FONT color=3D#0000ff size=3D2>
<P>class</FONT><FONT size=3D2> CABISet </FONT></P>
<P><FONT size=3D2>{</FONT></P>
<P><FONT size=3D2>.........</P></FONT><FONT color=3D#0000ff size=3D2>
<P><STRONG>virtual</STRONG></FONT><STRONG><FONT size=3D2> </FONT><FONT=20
color=3D#0000ff size=3D2>void</FONT><FONT size=3D2> Open(</FONT><FONT =
color=3D#0000ff=20
size=3D2>const</FONT><FONT size=3D2> string&amp; strSQL) =3D =
0;</FONT></STRONG></P>
<P><FONT size=3D2>}</P></FONT></FONT>
<P><FONT face=3DArial size=3D2><STRONG>HRESULT=20
CABIOleDbSet::OpenWithException(CABIOleDbSession&amp; session, const =
string&amp;=20
strCmd, DBPROPSET *pPropSet)</STRONG></FONT></P>
<P><FONT face=3DArial size=3D2>{</FONT></P>
<P><FONT face=3DArial =
size=3D2>if(session.IsOpen()=3D=3Dfalse)</FONT></P>
<P><FONT face=3DArial size=3D2>{</FONT></P>
<P><FONT face=3DArial size=3D2>ostringstream ost; </FONT></P>
<P><FONT face=3DArial size=3D2>ost &lt;&lt; "Session is not opened. =
Can'nt execute=20
command [" &lt;&lt; strCmd &lt;&lt; "]";</FONT></P>
<P><FONT face=3DArial size=3D2>throw CMyException(CONNECTION_ERROR, =
ost.str(),=20
__FILE__, __LINE__);</FONT></P>
<P><FONT face=3DArial size=3D2>}</FONT></P>
<P><FONT face=3DArial size=3D2>wstring wstrCmd =3D =
StrToWstr(strCmd);</FONT></P>
<P><FONT face=3DArial size=3D2>HRESULT hr =3D S_FALSE;</FONT></P>
<P><FONT face=3DArial size=3D2></FONT></P>
<P><FONT face=3DArial size=3D2>try</FONT></P>
<P><FONT face=3DArial size=3D2>{</FONT></P>
<P><FONT face=3DArial size=3D2><STRONG>hr =3DCCommand::Open(*m_pSession, =

wstrCmd.c_str(), pPropSet);//CRASHES here</STRONG></FONT></P>
<P><FONT face=3DArial size=3D2>}</FONT></P>
<P><FONT face=3DArial size=3D2>catch(...)</FONT></P>
<P><FONT face=3DArial size=3D2>{</FONT></P>
<P><FONT face=3DArial size=3D2>ASSERT(false);</FONT></P>
<P><FONT face=3DArial size=3D2>}</FONT></P>
<P><FONT face=3DArial size=3D2>return hr;</FONT></P>
<P><FONT face=3DArial size=3D2>}</FONT></P>
<P><FONT face=3DArial size=3D2>Any idea why?</FONT></P>
<P><FONT face=3DArial size=3D2>Thanks and Regards</FONT></P>
<P><FONT face=3DArial size=3D2>Ganga</FONT></P></DIV>
<DIV><FONT face=3DArial size=3D2>"Igor Tandetnik" &lt;</FONT><A=20
href=3D"mailto:itandetnik@mvps.org"><FONT face=3DArial=20
size=3D2>itandetnik@mvps.org</FONT></A><FONT face=3DArial size=3D2>&gt; =
wrote in=20
message </FONT><A =
href=3D"news:O6FGn0q4IHA.3484@TK2MSFTNGP05.phx.gbl"><FONT=20
face=3DArial =
size=3D2>news:O6FGn0q4IHA.3484@TK2MSFTNGP05.phx.gbl</FONT></A><FONT=20
face=3DArial size=3D2>...</FONT></DIV><FONT face=3DArial size=3D2>&gt; =
"Ganga Sridhar"=20
&lt;</FONT><A href=3D"mailto:gangasridhar@abosoftware.com"><FONT =
face=3DArial=20
size=3D2>gangasridhar@abosoftware.com</FONT></A><FONT face=3DArial =
size=3D2>&gt; wrote=20
in message<BR>&gt; </FONT><A=20
href=3D"news:egVe9lp4IHA.5060@TK2MSFTNGP02.phx.gbl"><FONT face=3DArial=20
size=3D2>news:egVe9lp4IHA.5060@TK2MSFTNGP02.phx.gbl</FONT></A><BR><FONT =
face=3DArial=20
size=3D2>&gt;&gt; When I use multiple inheritance i.e derived class =
CABIOleDBSet=20
from<BR>&gt;&gt; CCommand and CTest program crashes.<BR>&gt; <BR>&gt; =
Crashes=20
when doing what? I seem to have misplaced by crysal ball.<BR>&gt; -- =
<BR>&gt;=20
With best wishes,<BR>&gt;&nbsp;&nbsp;&nbsp; Igor Tandetnik<BR>&gt; =
<BR>&gt; With=20
sufficient thrust, pigs fly just fine. However, this is not <BR>&gt; =
necessarily=20
a good idea. It is hard to be sure where they are going to <BR>&gt; =
land, and it=20
could be dangerous sitting under them as they fly <BR>&gt; overhead. -- =
RFC 1925=20
<BR>&gt; <BR>&gt;</FONT></BODY></HTML>

------=_NextPart_000_016C_01C8E2EA.024AF2B0--


Re: Any problems expected in Multiple inheritance with template class ? by Igor

Igor
Thu Jul 10 13:55:52 CDT 2008

"Ganga Sridhar" <gangasridhar@abosoftware.com> wrote in message
news:ejFxqvr4IHA.2072@TK2MSFTNGP04.phx.gbl
> I have my derived class
> CABIOleDbSet : public CCommand<TAccessor, TRowset>, public CABISet
>
> {
> ...
> }
>
> hr =CCommand::Open(*m_pSession, wstrCmd.c_str(), pPropSet);//CRASHES

This should not even compile. It should be CCommand<TAccessor,
TRowset>::Open(...). Do you by any chance have a non-template class
named CCommand somewhere in your program?
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925



Re: Any problems expected in Multiple inheritance with template class ? by Ganga

Ganga
Fri Jul 11 03:35:00 CDT 2008

This is a multi-part message in MIME format.

------=_NextPart_000_001D_01C8E35F.1C72E830
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

It does compile successfully and I do not have any nontemplate class =
with the name CCommand.
Case1 : I tried putting in
hr =3DCCommand<TAccessor, > TRowset>::Open(*m_pSession, wstrCmd.c_str(), =
pPropSet);

then hr return S_FALSE, the open function fails in this case.

Case 2 : It however works absolutely fine when I make the following =
change before the call:
CCommand* pcmd =3D dynamic_cast<CCommand*>(this);

hr =3D pcmd->Open(*m_pSession, wstrCmd.c_str(), pPropSet);

I fail to understand what additional thing does the dynamic cast do?

Why is it not working in Case1 and working fine in case 2?

Any idea?

Thanks and Regards

Ganga




"Igor Tandetnik" <itandetnik@mvps.org> wrote in message =
news:%234ynW6r4IHA.1892@TK2MSFTNGP06.phx.gbl...
> "Ganga Sridhar" <gangasridhar@abosoftware.com> wrote in message
> news:ejFxqvr4IHA.2072@TK2MSFTNGP04.phx.gbl
>> I have my derived class
>> CABIOleDbSet : public CCommand<TAccessor, TRowset>, public CABISet
>>
>> {
>> ...
>> }
>>
>> hr =3DCCommand::Open(*m_pSession, wstrCmd.c_str(), =
pPropSet);//CRASHES
>=20
> This should not even compile. It should be CCommand<TAccessor,=20
> TRowset>::Open(...). Do you by any chance have a non-template class=20
> named CCommand somewhere in your program?
> --=20
> With best wishes,
> Igor Tandetnik
>=20
> With sufficient thrust, pigs fly just fine. However, this is not=20
> necessarily a good idea. It is hard to be sure where they are going to =

> land, and it could be dangerous sitting under them as they fly=20
> overhead. -- RFC 1925=20
>=20
>
------=_NextPart_000_001D_01C8E35F.1C72E830
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.6000.16674" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>It does compile successfully and I do =
not have any=20
nontemplate class with the name CCommand.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2><STRONG>Case1 </STRONG>: I tried =
putting=20
in</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>hr =3DCCommand&lt;TAccessor, &gt;=20
TRowset&gt;::Open(*m_pSession, wstrCmd.c_str(), pPropSet);</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>then hr return S_FALSE, the open =
function fails in=20
this case.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><STRONG>Case 2 : </STRONG>It however =
works=20
absolutely fine when I make the following change before the =
call:</FONT></DIV>
<DIV>
<P><FONT face=3DArial size=3D2>CCommand* pcmd =3D=20
dynamic_cast&lt;CCommand*&gt;(this);</FONT></P>
<P><FONT face=3DArial size=3D2>hr =3D pcmd-&gt;Open(*m_pSession, =
wstrCmd.c_str(),=20
pPropSet);</FONT></P>
<P><FONT face=3DArial size=3D2>I fail to understand what additional =
thing does the=20
dynamic cast do?</FONT></P>
<P><FONT face=3DArial size=3D2>Why is it not working in Case1 and =
working fine in=20
case 2?</FONT></P>
<P><FONT face=3DArial size=3D2>Any idea?</FONT></P>
<P><FONT face=3DArial size=3D2>Thanks and Regards</FONT></P>
<P><FONT face=3DArial size=3D2>Ganga</FONT></P></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>"Igor Tandetnik" &lt;</FONT><A=20
href=3D"mailto:itandetnik@mvps.org"><FONT face=3DArial=20
size=3D2>itandetnik@mvps.org</FONT></A><FONT face=3DArial size=3D2>&gt; =
wrote in=20
message </FONT><A =
href=3D"news:%234ynW6r4IHA.1892@TK2MSFTNGP06.phx.gbl"><FONT=20
face=3DArial =
size=3D2>news:%234ynW6r4IHA.1892@TK2MSFTNGP06.phx.gbl</FONT></A><FONT=20
face=3DArial size=3D2>...</FONT></DIV><FONT face=3DArial size=3D2>&gt; =
"Ganga Sridhar"=20
&lt;</FONT><A href=3D"mailto:gangasridhar@abosoftware.com"><FONT =
face=3DArial=20
size=3D2>gangasridhar@abosoftware.com</FONT></A><FONT face=3DArial =
size=3D2>&gt; wrote=20
in message<BR>&gt; </FONT><A=20
href=3D"news:ejFxqvr4IHA.2072@TK2MSFTNGP04.phx.gbl"><FONT face=3DArial=20
size=3D2>news:ejFxqvr4IHA.2072@TK2MSFTNGP04.phx.gbl</FONT></A><BR><FONT =
face=3DArial=20
size=3D2>&gt;&gt; I have my derived class<BR>&gt;&gt; CABIOleDbSet : =
public=20
CCommand&lt;TAccessor, TRowset&gt;, public =
CABISet<BR>&gt;&gt;<BR>&gt;&gt;=20
{<BR>&gt;&gt; ...<BR>&gt;&gt; }<BR>&gt;&gt;<BR>&gt;&gt; hr=20
=3DCCommand::Open(*m_pSession, wstrCmd.c_str(), =
pPropSet);//CRASHES<BR>&gt;=20
<BR>&gt; This should not even compile. It should be =
CCommand&lt;TAccessor,=20
<BR>&gt; TRowset&gt;::Open(...). Do you by any chance have a =
non-template class=20
<BR>&gt; named CCommand somewhere in your program?<BR>&gt; -- <BR>&gt; =
With best=20
wishes,<BR>&gt;&nbsp;&nbsp;&nbsp; Igor Tandetnik<BR>&gt; <BR>&gt; With=20
sufficient thrust, pigs fly just fine. However, this is not <BR>&gt; =
necessarily=20
a good idea. It is hard to be sure where they are going to <BR>&gt; =
land, and it=20
could be dangerous sitting under them as they fly <BR>&gt; overhead. -- =
RFC 1925=20
<BR>&gt; <BR>&gt;</FONT></BODY></HTML>

------=_NextPart_000_001D_01C8E35F.1C72E830--


Re: Any problems expected in Multiple inheritance with template class ? by Ganga

Ganga
Fri Jul 11 05:37:11 CDT 2008

This is a multi-part message in MIME format.

------=_NextPart_000_004B_01C8E370.2DD2A140
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hello
Thanks CCommand<TAccessor, > TRowset>:: resolves all my problems now.

But its surprising how it compiled successfully when I do not even have =
any nontemplate class with the name CCommand.

Thanks and Regards
Ganga
"Ganga Sridhar" <gangasridhar@abosoftware.com> wrote in message =
news:%233pjEEz4IHA.3804@TK2MSFTNGP03.phx.gbl...
It does compile successfully and I do not have any nontemplate class =
with the name CCommand.
Case1 : I tried putting in
hr =3DCCommand<TAccessor, > TRowset>::Open(*m_pSession, =
wstrCmd.c_str(), pPropSet);

then hr return S_FALSE, the open function fails in this case.

Case 2 : It however works absolutely fine when I make the following =
change before the call:
CCommand* pcmd =3D dynamic_cast<CCommand*>(this);

hr =3D pcmd->Open(*m_pSession, wstrCmd.c_str(), pPropSet);

I fail to understand what additional thing does the dynamic cast do?

Why is it not working in Case1 and working fine in case 2?

Any idea?

Thanks and Regards

Ganga




"Igor Tandetnik" <itandetnik@mvps.org> wrote in message =
news:%234ynW6r4IHA.1892@TK2MSFTNGP06.phx.gbl...
> "Ganga Sridhar" <gangasridhar@abosoftware.com> wrote in message
> news:ejFxqvr4IHA.2072@TK2MSFTNGP04.phx.gbl
>> I have my derived class
>> CABIOleDbSet : public CCommand<TAccessor, TRowset>, public CABISet
>>
>> {
>> ...
>> }
>>
>> hr =3DCCommand::Open(*m_pSession, wstrCmd.c_str(), =
pPropSet);//CRASHES
>=20
> This should not even compile. It should be CCommand<TAccessor,=20
> TRowset>::Open(...). Do you by any chance have a non-template class=20
> named CCommand somewhere in your program?
> --=20
> With best wishes,
> Igor Tandetnik
>=20
> With sufficient thrust, pigs fly just fine. However, this is not=20
> necessarily a good idea. It is hard to be sure where they are going =
to=20
> land, and it could be dangerous sitting under them as they fly=20
> overhead. -- RFC 1925=20
>=20
>
------=_NextPart_000_004B_01C8E370.2DD2A140
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.6000.16674" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hello</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Thanks CCommand&lt;TAccessor, &gt; =
TRowset&gt;::=20
resolves all my problems now.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>But its surprising&nbsp;how =
it&nbsp;compiled=20
successfully when I do not even&nbsp;have any nontemplate class with the =
name=20
CCommand.</FONT></DIV></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks and Regards</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Ganga</FONT></DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Ganga Sridhar" &lt;<A=20
=
href=3D"mailto:gangasridhar@abosoftware.com">gangasridhar@abosoftware.com=
</A>&gt;=20
wrote in message <A=20
=
href=3D"news:%233pjEEz4IHA.3804@TK2MSFTNGP03.phx.gbl">news:%233pjEEz4IHA.=
3804@TK2MSFTNGP03.phx.gbl</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>It does compile successfully and I do =
not have=20
any nontemplate class with the name CCommand.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2><STRONG>Case1 </STRONG>: I tried =
putting=20
in</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>hr =3DCCommand&lt;TAccessor, &gt;=20
TRowset&gt;::Open(*m_pSession, wstrCmd.c_str(), =
pPropSet);</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>then hr return S_FALSE, the open =
function fails=20
in this case.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><STRONG>Case 2 : </STRONG>It however =
works=20
absolutely fine when I make the following change before the =
call:</FONT></DIV>
<DIV>
<P><FONT face=3DArial size=3D2>CCommand* pcmd =3D=20
dynamic_cast&lt;CCommand*&gt;(this);</FONT></P>
<P><FONT face=3DArial size=3D2>hr =3D pcmd-&gt;Open(*m_pSession, =
wstrCmd.c_str(),=20
pPropSet);</FONT></P>
<P><FONT face=3DArial size=3D2>I fail to understand what additional =
thing does the=20
dynamic cast do?</FONT></P>
<P><FONT face=3DArial size=3D2>Why is it not working in Case1 and =
working fine in=20
case 2?</FONT></P>
<P><FONT face=3DArial size=3D2>Any idea?</FONT></P>
<P><FONT face=3DArial size=3D2>Thanks and Regards</FONT></P>
<P><FONT face=3DArial size=3D2>Ganga</FONT></P></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>"Igor Tandetnik" &lt;</FONT><A=20
href=3D"mailto:itandetnik@mvps.org"><FONT face=3DArial=20
size=3D2>itandetnik@mvps.org</FONT></A><FONT face=3DArial =
size=3D2>&gt; wrote in=20
message </FONT><A =
href=3D"news:%234ynW6r4IHA.1892@TK2MSFTNGP06.phx.gbl"><FONT=20
face=3DArial =
size=3D2>news:%234ynW6r4IHA.1892@TK2MSFTNGP06.phx.gbl</FONT></A><FONT=20
face=3DArial size=3D2>...</FONT></DIV><FONT face=3DArial size=3D2>&gt; =
"Ganga Sridhar"=20
&lt;</FONT><A href=3D"mailto:gangasridhar@abosoftware.com"><FONT =
face=3DArial=20
size=3D2>gangasridhar@abosoftware.com</FONT></A><FONT face=3DArial =
size=3D2>&gt;=20
wrote in message<BR>&gt; </FONT><A=20
href=3D"news:ejFxqvr4IHA.2072@TK2MSFTNGP04.phx.gbl"><FONT face=3DArial =

=
size=3D2>news:ejFxqvr4IHA.2072@TK2MSFTNGP04.phx.gbl</FONT></A><BR><FONT=20
face=3DArial size=3D2>&gt;&gt; I have my derived class<BR>&gt;&gt; =
CABIOleDbSet :=20
public CCommand&lt;TAccessor, TRowset&gt;, public=20
CABISet<BR>&gt;&gt;<BR>&gt;&gt; {<BR>&gt;&gt; ...<BR>&gt;&gt;=20
}<BR>&gt;&gt;<BR>&gt;&gt; hr =3DCCommand::Open(*m_pSession, =
wstrCmd.c_str(),=20
pPropSet);//CRASHES<BR>&gt; <BR>&gt; This should not even compile. It =
should=20
be CCommand&lt;TAccessor, <BR>&gt; TRowset&gt;::Open(...). Do you by =
any=20
chance have a non-template class <BR>&gt; named CCommand somewhere in =
your=20
program?<BR>&gt; -- <BR>&gt; With best =
wishes,<BR>&gt;&nbsp;&nbsp;&nbsp; Igor=20
Tandetnik<BR>&gt; <BR>&gt; With sufficient thrust, pigs fly just fine. =

However, this is not <BR>&gt; necessarily a good idea. It is hard to =
be sure=20
where they are going to <BR>&gt; land, and it could be dangerous =
sitting under=20
them as they fly <BR>&gt; overhead. -- RFC 1925 <BR>&gt; =
<BR>&gt;</FONT>=20
</BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_004B_01C8E370.2DD2A140--