This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I'm having trouble with some linq queries:
var taxNos = from a in allData select new SolventnostIdOurs { davcna = a.davcnaStevilkaDolznika, zacetek = a.zacetekPostopka };
var sozenotDB = skbb.SodisceInsolvs.Where( p=> taxNos.Any( s=>s.davcna == p.Id.TaxFileNo && s.zacetek == p.Id.ZacetekPostopka ));
This produces this error:
base {System.SystemException} = {"Unable to cast object of type 'Mindscape.LightSpeed.Querying.LiteralExpression' to type 'Mindscape.LightSpeed.Querying.IAttributePathExpression'."} allData is an IEnumerable list, skbb. SodisceInsolvs is from Oracle DB. I've also tried this:
var sozenotDB = from d in skbb.SodisceInsolvs where taxNos.Contains(new SolventnostIdOurs { davcna = d.Id.TaxFileNo, zacetek = d.Id.ZacetekPostopka }) select d; and I get this error: base {System.SystemException} = {"Specified method is not supported."} Any suggestions would be appreciated!
|
|
|
The first is the same issue you reported earlier: we have reproduced this and are investigating. Regarding the second, we do not currently support comparisons such as Contains with anonymous types. We'll look at adding support for this but we can't commit to it. |
|
|
I have now tried in this way:
var taxNos = from a in allData select a.davcnaStevilkaDolznika+a.zacetekPostopka;
var sozenotDB = from d in skbb.SodisceInsolvs where taxNos.Contains( d.Id.TaxFileNo+d.Id.ZacetekPostopka ) select d; Now I don't get an error but get no results even though there should be. Is there a way to see what SQL is generated?
Sorry for the double reporting, things came in between and I forgot what I've already posted and what not. :(
Thank you for your help!
|
|
|
I should've known this isn't going to work... :( sql: " ... FROM SODISCE_INSOLV WHERE SODISCE_INSOLV.TAX_FILE_NO IN ('9959377717.3.2010 0:00:00', '7861050817.3.2010 0:00:00');"
|
|
|
You can see what SQL is generated by setting the LightSpeedContext.Logger property. See Help Topics > LightSpeed > Logging in the docs. The issue with the updated query looks like a bug -- looks like we're losing the "+ d.Id.ZacetekPostopka" bit in the process of translating to SQL. This appears to be working in our test environment: could you try installing the current nightly build and see if you stil get the same issue? |
|
|
Where can I get it? I'm using the express version now. |
|
|
Hi Robert, You can download the nightly build for the Express edition from http://www.mindscape.co.nz/products/lightspeed/nightlybuilds.aspx
Jeremy
|
|
|
http://www.mindscape.co.nz/products/lightspeed/nightlybuilds.aspx |
|
|
With the nightly i get this: Traversing relationships is not supported on the right hand side of a predicate
|
|
|
well, this is frustrating. I've now created a new view in oracle that has these fields combined and tried this:
var taxNos = (from a in allData select a.davcnaStevilkaDolznika + a.zacetekPostopka.ToString("dd-MMM-yyyy", CultureInfo.CreateSpecificCulture("en-US"))).ToArray(); var sozenotDB = from d in skbb.SodisceInsolvVs
where taxNos.Contains(d.Davcnainzacetek)
select d;
SQL I get is this, which looks ok:
SELECT SODISCE_INSOLV_V.Id AS "id_0", SODISCE_INSOLV_V.Davcnainzacetek AS "davcnain_0", SODISCE_INSOLV_V.DELEZ_POPLACILA_KONCNO AS "delez_po_0", SODISCE_INSOLV_V.DELEZ_POPLACILA_OCENA AS "delez_po_1", SODISCE_INSOLV_V.FIRMA_IME_DOLZNIKA AS "firma_im_0", SODISCE_INSOLV_V.KONCANJE_POSTOPKA_DATUM AS "koncanje_0", SODISCE_INSOLV_V.KONCANJE_POSTOPKA_TIP AS "koncanje_1", SODISCE_INSOLV_V.KONCANJE_POSTOPKAPRAVNOMOCNOST AS "koncanje_2", SODISCE_INSOLV_V.MATICNA_STEVILKA_DOLZNIKA AS "maticna__0", SODISCE_INSOLV_V.ODPUST_OBVEZNOSTI_PRAVNOMOCNOS AS "odpust_o_0", SODISCE_INSOLV_V.ODPUST_OBVEZNOSTI_SKLEP AS "odpust_o_1", SODISCE_INSOLV_V.ODPUST_OBVEZNOSTI_ZACETEK AS "odpust_o_2", SODISCE_INSOLV_V.ROJSTNI_DATUM_DOLZNIKA AS "rojstni__0", SODISCE_INSOLV_V.ROK_UVELJAVITEV_PREREKANIH_TER AS "rok_uvel_0", SODISCE_INSOLV_V.ROK_ZA_PRIJAVO_TERJATEV AS "rok_za_p_0", SODISCE_INSOLV_V.Sodisce AS "sodisce_0", SODISCE_INSOLV_V.Sodnik AS "sodnik_0", SODISCE_INSOLV_V.ST_STEVILKA AS "st_stevi_0", SODISCE_INSOLV_V.STECAJNA_MASA_KONCNO AS "stecajna_0", SODISCE_INSOLV_V.STECAJNA_MASA_OCENA AS "stecajna_1", SODISCE_INSOLV_V.TAX_FILE_NO AS "tax_file_0", SODISCE_INSOLV_V.TIP_POSTOPKA AS "tip_post_0", SODISCE_INSOLV_V.TIP_POSTOPKA_SIF AS "tip_post_1", SODISCE_INSOLV_V.Upravitelj AS "upravite_0", SODISCE_INSOLV_V.ZACETEK_POSTOPKA AS "zacetek__0", SODISCE_INSOLV_V.Ziv AS "ziv_0" FROM SODISCE_INSOLV_V WHERE SODISCE_INSOLV_V.Davcnainzacetek IN ('9959377717-Mar-2010', '7861050817-Mar-2010');
The frustrating this is that I get no results. If I run the same query in Oracle I get one row back which is what it should be. I wonder if this is now because of the nightly? |
|
|
Well, I've solved this one as well. It seems that when connecting through lightspeed I get back dates formatted differently, so even though the query above matches when run in SQL Navigator, it does not when run through lightspeed. Probably some strange Oracle thing...
|
|