LinqConnect Professional Version 4.1.197 (28-Feb-2013) - DataSource in XtraGrid

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
AKRRKA
Posts: 198
Joined: Thu 26 Jan 2012 15:07
Location: Russia
Contact:

LinqConnect Professional Version 4.1.197 (28-Feb-2013) - DataSource in XtraGrid

Post by AKRRKA » Tue 05 Mar 2013 16:11

Hello,

1) Two contexts to connect to MySQL and MS SQL, with the same table structure.
2) Two objects using each of its context.
3) One form with a grid.
4) Using the code for the first MySQL context and output the in a grid, and then do the same for MS SQL.

Code: Select all

private DevExpress.XtraGrid.GridControl meteringUnitsGrid;
...
meteringUnitsGrid = new DevExpress.XtraGrid.GridControl();
...
IQueryable mulistMySQL = from m in DataContextMySQL.Meters select m; // DataContext from MySQL
meteringUnitsGrid.DataSource = mulistMySQL;
...
IQueryable mulistMSSQL = from m in DataContextMSSQL.Meters select m; // DataContext from MS SQL
meteringUnitsGrid.DataSource = null;
meteringUnitsGrid.DataBindings.Clear();
meteringUnitsGrid.DataSource = mulistMSSQL;
....
Get error:
System.InvalidCastException was unhandled
HResult=-2147467262
Message=Unable to cast object of type "Devart.Data.MySql.Linq.Provider.MySqlProviderType" to type "Devart.Data.SqlServer.Linq.Provider.SqlProviderType".
Source=Devart.Data.SqlServer.Linq
StackTrace:
in Devart.Data.SqlServer.Linq.Provider.SqlDataProvider.ApplyParameter(DbParameter parameter, String name, ParameterDirection direction, ProviderType providerType, Type clrType, Object parameterValue)
in Devart.Data.Linq.DataProvider.a(c1 A_0, Object[] A_1)
in Devart.Data.Linq.DataProvider.b(c1 A_0, Object[] A_1)
in Devart.Data.Linq.Engine.a5.a(IProvider A_0, Object[] A_1)
in Devart.Data.Linq.Engine.DataQuery`1.h()
in System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
in System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
in Devart.Data.Linq.Engine.DataQuery`1.a()
in Devart.Data.Linq.Engine.DataQuery`1.i()
in DevExpress.XtraGrid.GridControl.GetDataSet()
in DevExpress.XtraGrid.GridControl.RemoveDataSetEvents()
in DevExpress.XtraGrid.GridControl.set_DataSource(Object value)
.....
Please help!
How can i do it???

AKRRKA
Posts: 198
Joined: Thu 26 Jan 2012 15:07
Location: Russia
Contact:

Re: LinqConnect Professional Version 4.1.197 (28-Feb-2013) - DataSource in XtraGrid

Post by AKRRKA » Wed 06 Mar 2013 05:30

I wrote and in support DevExpress (Q479377).

But tested with a standard grid, and with DataGridView also has this problem.

Please help.
This is very important! And now it is a big problem for me.
Thanks.

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: LinqConnect Professional Version 4.1.197 (28-Feb-2013) - DataSource in XtraGrid

Post by MariiaI » Thu 07 Mar 2013 12:18

We have answered you via the mail.

AKRRKA
Posts: 198
Joined: Thu 26 Jan 2012 15:07
Location: Russia
Contact:

Re: LinqConnect Professional Version 4.1.197 (28-Feb-2013) - DataSource in XtraGrid

Post by AKRRKA » Mon 11 Mar 2013 05:59

Thank you.
In your example, there is no problem.
Strange. I will look for the reason.

Post Reply