1 message in com.mysql.lists.dotnetUnable to cast object of type 'MySql....
FromSent OnAttachments
Bill Angus18 Nov 2005 11:10 
Subject:Unable to cast object of type 'MySql.Data.MySqlClient.MySqlCommand' to type 'System.Data.Common.DbCommand'.
From:Bill Angus (mdan@psychtest.com)
Date:11/18/2005 11:10:25 AM
List:com.mysql.lists.dotnet

Dear All:

The following code (with appropriately initialized instances of the MySQL Connector/net objects), throws the error: Unable to cast object of type 'MySql.Data.MySqlClient.MySqlCommand' to type 'System.Data.Common.DbCommand'.

Has anybody else got this error (or has anyone gotten the .FillSchema method to work using different syntax)?

Environment... o MySQL (either 4.1 or 5.15 tried with both). o MySqlConnector/net 1.0.6 o Windows2000 Pro o VB 2005/.NET2

Code:

--------------- ... /snip strGetSQL ="Select * FROM pminvtry WHERE name>='0' ORDER BY name,name2 LIMIT 30;" MyTitleSelectCommand.CommandText = strGetSQL

myTitleAdapter.SelectCommand = MyTitleSelectCommand

MyTitleTable.Clear()

myTitleAdapter.FillSchema(MyTitleTable, SchemaType.Source) ' ***THIS FAILS with either of the two SchemaType.options )

/snip

---------------

Thanks in advance and have a great day!