New Posts New Posts RSS Feed: Query Search Many to many
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Query Search Many to many

 Post Reply Post Reply
Author
bala View Drop Down
Groupie
Groupie
Avatar

Joined: 18-Aug-2010
Location: Brazil
Posts: 54
Post Options Post Options   Quote bala Quote  Post ReplyReply Direct Link To This Post Topic: Query Search Many to many
    Posted: 06-Oct-2010 at 6:52am
Hi There

I have one problem in searching recrods

When I search record first time it return nothing in first click but second click
it returning the records...
I using following code.
Where Is Mistake?

 ObservableCollection<PESSOA_PROFISSAO> Profissoes = new ObservableCollection<PESSOA_PROFISSAO>();

_em.PESSOA_PROFISSAO_GRUPOS.Where(f => f.ID_PESSOA_PROFISSAO_GRUPO == PessoaProfissaoGrupo.ID_PESSOA_PROFISSAO_GRUPO).ExecuteAsync(op =>

         {
             if (op.IsCompleted)
             {
                 op.Results.FirstOrDefault().PESSOA_PROFISSAO.ForEach(Profissoes.Add);

                 agDataGrid3.DataSource = Profissoes;

             }
             else
             {

                 MessageBox.Show(op.Error.Message);
             }
         });

Thanks
Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 06-Oct-2010 at 11:12am
Hi Bala;

Could you try and change your query as follows

_em.PESSOA_PROFISSAO_GRUPOS
.Where(f => f.ID_PESSOA_PROFISSAO_GRUPO == PessoaProfissaoGrupo.ID_PESSOA_PROFISSAO_GRUPO)
.Include(f => PESSOA_PROFISSAO)
.ExecuteAsync(op =>

{

//Rest of the code here

});
Back to Top
bala View Drop Down
Groupie
Groupie
Avatar

Joined: 18-Aug-2010
Location: Brazil
Posts: 54
Post Options Post Options   Quote bala Quote  Post ReplyReply Direct Link To This Post Posted: 08-Oct-2010 at 12:07pm
Hi Denis

Thanks for help.. This code works..


Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down