Page 1 of 1

LinqConnect to MsSql

Posted: Tue 19 Nov 2013 14:51
by Zero-G.
Hey

I use the following SQL Statement:

Code: Select all

Dim fachgebiet = From Query In myEldaContext.Fachgebiets _
                                 Select Id = Convert.ToInt64(Query.Wert), Beschreibung = Query.Beschreibung
it is getting translated to this:

Code: Select all

SELECT [t1].[Feld1] AS [C1], [t1].[Feld2] AS [Beschreibung]
FROM [dbo].[Fachgebiet] [t1]
-- Context: Devart.Data.SqlServer.Linq.Provider.SqlDataProvider Mapping: AttributeMappingSource Build: 4.4.374.0
Why is this? - I Need the field called ID not C1

THX

Re: LinqConnect to MsSql

Posted: Tue 19 Nov 2013 16:24
by MariiaI
This is the generated SQL query, which corresponds to the LINQ query being performed. The principle of generating is based on the different rules and conditions. This does not affect the result you are getting in your application. With this query you should eventually get this:

Code: Select all

(0) = Id="1", Beschreibung="test"
(1) = Id="4", Beschreibung="test"

Re: LinqConnect to MsSql

Posted: Tue 19 Nov 2013 16:40
by Zero-G.
Hey

I have sended you a sample Project where you can find the error.

THX

Re: LinqConnect to MsSql

Posted: Wed 20 Nov 2013 11:02
by MariiaI
Thank you for the sample project. We have reproduced the "Specified cast is not valid" error (ToInt64,ToInt32). We will investigate it and inform you about the results as soon as possible.

Re: LinqConnect to MsSql

Posted: Fri 13 Dec 2013 06:27
by MariiaI
The bug with the data type conversions during materialization is fixed.
New build of LinqConnect 4.4.393 is available for download now!
It can be downloaded from http://www.devart.com/linqconnect/download.html (trial version) or from Registered Users' Area (for users with active subscription only).
For more information, please refer to http://forums.devart.com/viewtopic.php?f=31&t=28506.