Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > LLBLGen Pro Runtime Framework> How to translate this query to Dynamic Query
 

Pages: 1
LLBLGen Pro Runtime Framework
How to translate this query to Dynamic Query
Page:1/1 

  Print all messages in this thread  
Poster Message
19252
User



Location:

Joined on:
12-Jul-2019 18:24:08
Posted:
10 posts
# Posted on: 11-Nov-2019 17:43:27.  
Hello Guys,

i'm here again Sad to ask your support.
I want to write a Dynamic Query to implement the following SQL query

Code:
SELECT        dbo.T_S_DocumentoTipologiaUtentiCollegati.ConsentiAzienda, dbo.T_S_DocumentoTipologiaUtentiCollegati.ConsentiContatto, dbo.T_S_DocumentoTipologiaUtentiCollegati.Descrizione,
                         dbo.T_S_DocumentoTipologiaUtentiCollegati.IDDocumentoTipologiaUtentiCollegati, dbo.T_S_DocumentoTipologiaUtentiCollegati.IDDocumentoTipologiaProgetti, dbo.T_A_Aziende_Varie.IDAzienda,
                         dbo.T_A_Aziende_Varie.IDUtente, dbo.T_A_Aziende.RagioneSociale, dbo.T_A_Contatti.IDContatto, dbo.T_A_Contatti.IDAccUtente, dbo.T_A_Contatti.Cognome, dbo.T_A_Contatti.Nome,
                         dbo.T_P_DocumentiUtentiNew.IDDocumento
FROM            dbo.T_A_Aziende INNER JOIN
                         dbo.T_A_Aziende_Varie ON dbo.T_A_Aziende.IDAzienda = dbo.T_A_Aziende_Varie.IDAzienda RIGHT OUTER JOIN
                         dbo.T_S_DocumentoTipologiaUtentiCollegati INNER JOIN
                         dbo.T_P_DocumentiUtentiNew ON dbo.T_S_DocumentoTipologiaUtentiCollegati.IDDocumentoTipologiaUtentiCollegati = dbo.T_P_DocumentiUtentiNew.IDDocumentoTipologiaUtentiCollegati INNER JOIN
                         dbo.T_A_Acc_Utenti ON dbo.T_P_DocumentiUtentiNew.IDAccUtente = dbo.T_A_Acc_Utenti.IDAccUtente ON dbo.T_A_Aziende_Varie.IDUtente = dbo.T_A_Acc_Utenti.IDAccUtente LEFT OUTER JOIN
                         dbo.T_A_Contatti ON dbo.T_A_Acc_Utenti.IDAccUtente = dbo.T_A_Contatti.IDAccUtente
WHERE        (dbo.T_P_DocumentiUtentiNew.IDDocumento = 6241)


but i cant understand how to write the code related to

Code:
RIGHT OUTER JOIN dbo.T_S_DocumentoTipologiaUtentiCollegati INNER JOIN

as there is no "ON" clause

I'm thinkin i should rewrite the query but cant understand the way to do it ...

By now i tried it this way but it doesnt work, as it reports "'The ON clause for the Right join is null'"
Code:
                 var q2 = qf.TAAziende
                                         .Select(() => new
                                         {
                                             IdDocumentoTipologiaUtentiCollegati = TSDocumentoTipologiaUtentiCollegatiFields.IddocumentoTipologiaUtentiCollegati.ToValue<int>(),
                                             IdDocumentoTipologiaProgetti = TSDocumentoTipologiaUtentiCollegatiFields.IddocumentoTipologiaProgetti.ToValue<int>(),
                                             ConsentiAzienda = TSDocumentoTipologiaUtentiCollegatiFields.ConsentiAzienda.ToValue<bool?>(),
                                             ConsentiContatto = TSDocumentoTipologiaUtentiCollegatiFields.ConsentiContatto.ToValue<bool?>(),
                                             Descrizione = TSDocumentoTipologiaUtentiCollegatiFields.Descrizione.ToValue<string>(),
                                             IdAzienda = TAAziendeFields.Idazienda.ToValue<int?>(),
                                             IdAccAzienda = TAAziendeVarieFields.Idutente.ToValue<int?>(),
                                             RagioneSocialeAzienda = TAAziendeFields.RagioneSociale.ToValue<string>(),
                                             IdContatto = TAContattiFields.Idcontatto.ToValue<int?>(),
                                             IdAccContatto = TAContattiFields.IdaccUtente.ToValue<int?>(),
                                             CognomeContatto = TAContattiFields.Cognome.ToValue<string>(),
                                             NomeContatto = TAContattiFields.Nome.ToValue<string>()
                                         })
                            .From(QueryTarget.InnerJoin(TAAziendeVarieEntity.Relations.TAAziendeEntityUsingIdazienda)
                            .RightJoin((qf.TSDocumentoTipologiaUtentiCollegati)
                            .InnerJoin(TPDocumentiUtentiNewEntity.Relations.TSDocumentoTipologiaUtentiCollegatiEntityUsingIddocumentoTipologiaUtentiCollegati)
                            .InnerJoin(TAAccUtentiEntity.Relations.TPDocumentiUtentiNewEntityUsingIdaccUtente)
                            .LeftJoin(TAContattiEntity.Relations.TAAccUtentiEntityUsingIdaccUtente)))
                            .Where(TSDocumentiNewFields.Iddocumento == iddocumento);

Can you please support me?
Thanks in advance
  Top
Walaa
Support Team



Location:

Joined on:
21-Aug-2005 16:03:48
Posted:
14529 posts
# Posted on: 12-Nov-2019 04:38:58.  
Why do you want to use a Join without the On condition?
Could you please explain what are you trying to query?


  Top
19252
User



Location:

Joined on:
12-Jul-2019 18:24:08
Posted:
10 posts
# Posted on: 12-Nov-2019 21:10:27.  
Walaa wrote:
Why do you want to use a Join without the On condition?
Could you please explain what are you trying to query?

mmm because that query works on sql server? Regular Smiley

So, if it cant be done with llbl i think i have to rewrite it in another way?
  Top
19252
User



Location:

Joined on:
12-Jul-2019 18:24:08
Posted:
10 posts
# Posted on: 12-Nov-2019 23:25:13.  
Walaa wrote:
Why do you want to use a Join without the On condition?
Could you please explain what are you trying to query?


Dont worry, i rewrote the query
Thanks


  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37643 posts
# Posted on: 13-Nov-2019 09:17:21.  
It would still be beneficial to know what solved it, perhaps for others who run into the same issue? (I still think the SQL query you posted is incomplete)
Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.