Click here to Skip to main content
15,887,338 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionDeconstruction of a VBA Code Module Pin
ruvain18-Feb-15 0:41
ruvain18-Feb-15 0:41 
AnswerRe: Deconstruction of a VBA Code Module Pin
Chris Quinn18-Feb-15 1:00
Chris Quinn18-Feb-15 1:00 
QuestionData entry in VB6Flexgrid1 developed by Mostafa Kaisoun Pin
Preeti197917-Feb-15 21:23
Preeti197917-Feb-15 21:23 
AnswerRe: Data entry in VB6Flexgrid1 developed by Mostafa Kaisoun Pin
Chris Quinn17-Feb-15 21:37
Chris Quinn17-Feb-15 21:37 
AnswerRe: Data entry in VB6Flexgrid1 developed by Mostafa Kaisoun Pin
den2k8817-Feb-15 22:13
professionalden2k8817-Feb-15 22:13 
GeneralRe: Data entry in VB6Flexgrid1 developed by Mostafa Kaisoun Pin
Preeti197918-Feb-15 22:23
Preeti197918-Feb-15 22:23 
QuestionEntity Framework : Set value of a not-mapped property inside a query Pin
dilkonika17-Feb-15 17:03
dilkonika17-Feb-15 17:03 
QuestionEntity Framework : Incorrect result in child collections when repeat query Pin
dilkonika16-Feb-15 15:53
dilkonika16-Feb-15 15:53 
Hello !
I'm using Entity framework. I have this scenario :

ParentObject - has a child collection : Child1.

On the Form I have 1 checkbox and 1 button. I have a report that display the PArentObject and the corresponding list of Child1.

the Onclick's event of the button has this code :
VB
context.Configuration.LazyLoadingEnabled = False
Dim plist as IQueryable(Of ParentObject)
Dim chlist as IQueryable(of Child1)
plist=context.Set(Of ParentObject)
chlist=context.Set(of Child1)

plist.ToList()
chlist=chlist.Where(Function(t1) plist.Any(Function(t2) t2.id=t1.parent))
If checkbox1.checked then chlist=chlist.Where(Function(t1) t1.vl>0)
chlist.ToList()
MyReport.Datasource=plist.ToList

These are the result when I press the button :
SQL
1) With checkbox checked , Press the button ( first time ) - The report  display all the Parent , each of them with only the childs that have vl1>0 ( **Correct** )
2) With checkbox unchecked , press the button (second time ) - The report  display all the Parent with all the childs ( **Correct** )
3) With checkbox checked , press the button ( third time ) - The report display all the parent with all the childs  ( **Not correct** )

I close the form , and re-open it
VB
1) With checkbox unchecked , press the button (First time ) - The report display all the Parent with all the childs ( **Correct** )
 2) With checkbox checked , press the button ( Second time ) - The report display all the parent with all the childs  ( **Not correct** )


Why I get not correct results when repeating the queries like in the examples above ? What should I do in these cases ?
Thank you !
QuestionWindows Form VB 2010 Pin
BobbyStrain16-Feb-15 6:37
BobbyStrain16-Feb-15 6:37 
SuggestionRe: Windows Form VB 2010 Pin
Richard MacCutchan16-Feb-15 7:42
mveRichard MacCutchan16-Feb-15 7:42 
GeneralRe: Windows Form VB 2010 Pin
BobbyStrain16-Feb-15 8:51
BobbyStrain16-Feb-15 8:51 
GeneralRe: Windows Form VB 2010 Pin
Dave Kreskowiak16-Feb-15 9:39
mveDave Kreskowiak16-Feb-15 9:39 
GeneralRe: Windows Form VB 2010 Pin
BobbyStrain16-Feb-15 9:59
BobbyStrain16-Feb-15 9:59 
GeneralRe: Windows Form VB 2010 Pin
Dave Kreskowiak16-Feb-15 10:11
mveDave Kreskowiak16-Feb-15 10:11 
GeneralRe: Windows Form VB 2010 Pin
BobbyStrain16-Feb-15 10:18
BobbyStrain16-Feb-15 10:18 
GeneralRe: Windows Form VB 2010 Pin
Dave Kreskowiak16-Feb-15 10:38
mveDave Kreskowiak16-Feb-15 10:38 
GeneralRe: Windows Form VB 2010 Pin
BobbyStrain16-Feb-15 12:15
BobbyStrain16-Feb-15 12:15 
GeneralRe: Windows Form VB 2010 Pin
Dave Kreskowiak16-Feb-15 12:31
mveDave Kreskowiak16-Feb-15 12:31 
GeneralRe: Windows Form VB 2010 Pin
Richard MacCutchan16-Feb-15 21:18
mveRichard MacCutchan16-Feb-15 21:18 
GeneralRe: Windows Form VB 2010 Pin
BobbyStrain17-Feb-15 5:39
BobbyStrain17-Feb-15 5:39 
GeneralRe: Windows Form VB 2010 Pin
Richard MacCutchan17-Feb-15 6:06
mveRichard MacCutchan17-Feb-15 6:06 
GeneralRe: Windows Form VB 2010 Pin
BobbyStrain17-Feb-15 10:35
BobbyStrain17-Feb-15 10:35 
QuestionEntity Framework : Using summary functions inside a projection Pin
dilkonika15-Feb-15 16:30
dilkonika15-Feb-15 16:30 
AnswerRe: Entity Framework : Using summary functions inside a projection Pin
Dave Kreskowiak15-Feb-15 17:42
mveDave Kreskowiak15-Feb-15 17:42 
GeneralRe: Entity Framework : Using summary functions inside a projection Pin
dilkonika15-Feb-15 17:50
dilkonika15-Feb-15 17:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.