"Unable to cast object of type
'Sybase.Data.AseClient.AseCommandBuilder' to type
'System.Data.Common.DbCommandBuilder'."
My code is:
DbCommandBuilder builder = null;
builder =
(DbCommandBuilder)Activator.CreateInstance(typeof(Sybase.Data.AseClient.AseCommandBuilder)
, adapter);
I am using Sybase.AdoNet2.AseClient.dll and sybdrvado20.dll
I do not have any problems casting other objects such as a
datareader or a datacommand.
My environment is:
Microsoft Visual Studio 2008 |
Version 9.0.21022.8 RTM |
Microsoft .NET Framework |
Version 3.5 SP1 |
Installed Edition: C# Express |
Microsoft Visual C# 2008 91910-152-0000061-60814 |
Microsoft Visual C# 2008 |
Microsoft Windows Vista Ultimate
Version 6.0.6001 Service Pack 2 Build 6002 |
IIS Version 7.0.6000.16386 |
Express Studio Net 3.5 |
Any suggestions or known issues with the AseADO client would
be helpful.
Regards, Kenn
What version of the Provider is this?
-Paul
<kenn.minear> wrote in message news:4b43a543.291...@sybase.com...
Sybase.Data.AseClient1.AseCommandBuilder ???
-Paul
<kenn.minear> wrote in message news:4b43a543.291...@sybase.com...
Regards, Kenn
Regards, Kenn
> Hi Kenn,
>
> What version of the Provider is this?
>
> -Paul
>
> <kenn.minear> wrote in message
> news:4b43a543.291...@sybase.com... >I am
> > implementing a factory model with Sybase ASE as one of
> the available database backend engines. When I try to
> > cast the CommandBuilder, I get the following exception:
> >
> > "Unable to cast object of type
> > 'Sybase.Data.AseClient.AseCommandBuilder' to type
> > 'System.Data.Common.DbCommandBuilder'."
> >
> > My code is:
> > DbCommandBuilder builder = null;
> > builder =
> >
> (DbCommandBuilder)Activator.CreateInstance(typeof(Sybase.D
> > ata.AseClient.AseCommandBuilder) , adapter);
I'm not sure I quite understand the question, I don't use
the API directly, the objects are cast to System.Data.Common
objects and executed using normal ADO commands, this way the
code doesn't need to know whether they are talking to Sybase
ASE, IBM DB2, PostgreSQL, etc. This is working great, I can
do all my CRUD functions against ASE, query, etc. The only
thing I cannot do is cast the command builder to update a
dataset.
Regards, Kenn
> Also what happens when you do
>
> Sybase.Data.AseClient1.AseCommandBuilder ???
>
> -Paul
>
> <kenn.minear> wrote in message
> news:4b43a543.291...@sybase.com... >I am
> > implementing a factory model with Sybase ASE as one of
> the available database backend engines. When I try to
> > cast the CommandBuilder, I get the following exception:
> >
> > "Unable to cast object of type
> > 'Sybase.Data.AseClient.AseCommandBuilder' to type
> > 'System.Data.Common.DbCommandBuilder'."
> >
> > My code is:
> > DbCommandBuilder builder = null;
> > builder =
> >
> (DbCommandBuilder)Activator.CreateInstance(typeof(Sybase.D
> > ata.AseClient.AseCommandBuilder) , adapter);
http://www.eggheadcafe.com/community/aspnet/10/10029734/error-with-dataadapterup.aspx
Regards, Kenn
> I am implementing a factory model with Sybase ASE as one
> of the available database backend engines. When I try to
> cast the CommandBuilder, I get the following exception:
>
> "Unable to cast object of type
> 'Sybase.Data.AseClient.AseCommandBuilder' to type
> 'System.Data.Common.DbCommandBuilder'."
>
> My code is:
> DbCommandBuilder builder = null;
> builder =
> (DbCommandBuilder)Activator.CreateInstance(typeof(Sybase.D
> ata.AseClient.AseCommandBuilder) , adapter);
Regards, Kenn
For example:
AseCommand
+- Base Types
+- Component
+- ICloneable
+- IDbCommand
+- IDisposable
AseCommandBuilder
+- Base Types
+- Component
+- IComponent
+- IDisposable
+- MarshalByRefObject
Shouldn't there be an IDBCommandBuilder under Component?
Every other object has an IDb<Type> under it's component.
I hope this might be a clue why I can't cast the
AseCommandBuilder to DbCommandBuilder.
Regards, Kenn
Regards, Kenn
I modified my code to check for Sybase as the backend and
used the AseCommandBuilder object directly. It works fine.
I can live with this workaround, but I think you should be
aware that there is some problem with not being able to cast
AseCommandBuilder to DbCommandBuilder.
Regards and thanks for your help, Kenn
> Also what happens when you do
>
> Sybase.Data.AseClient1.AseCommandBuilder ???
>
> -Paul
>
> <kenn.minear> wrote in message
> news:4b43a543.291...@sybase.com... >I am
> > implementing a factory model with Sybase ASE as one of
> the available database backend engines. When I try to
> > cast the CommandBuilder, I get the following exception:
> >
> > "Unable to cast object of type
> > 'Sybase.Data.AseClient.AseCommandBuilder' to type
> > 'System.Data.Common.DbCommandBuilder'."
> >
> > My code is:
> > DbCommandBuilder builder = null;
> > builder =
> >
> (DbCommandBuilder)Activator.CreateInstance(typeof(Sybase.D
> > ata.AseClient.AseCommandBuilder) , adapter);
Will you be able to open a Tech Support case with Sybase so this
can be reported to Engineering. I don't know why this shouldn't work.
It might be an issue withthe declaration in the Provider code or maybe some
reason why it
itsn't "inheriting" this capability from teh generic class.
At leastr we could report it and if it's resolvable then at some point you
can code the way you
want.
Thank you.
-Paul
<kenn.minear> wrote in message news:4b43e870.34b...@sybase.com...