|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Object reference not set to an instanceoccurs: Object reference not set to an instance or (in French "Une exception non gérée du type 'System.NullReferenceException' s'est produite dans system.data.dll, Informations supplémentaires : La référence d'objet n'est pas définie à une instance d'un objet") is due to the use of this instruction : .... ........... Dim fkc As ForeignKeyConstraint Here ---> fkc = New ForeignKeyConstraint("personnePhysique_telephones",new DataColumn(){Me.tablepersonnePhysique.personnePhysique_IdColumn}, new DataColumn(){Me.tabletelephones.personnePhysique_IdColumn})<--- Here Me.tabletelephones.Constraints.Add(fkc) fkc.AcceptRejectRule = System.Data.AcceptRejectRule.None fkc.DeleteRule = System.Data.Rule.Cascade fkc.UpdateRule = System.Data.Rule.Cascade .. .......... ...... I checked the definition of all objects and apparently are well defined. Please what's wrong? Above u've whole code of my application Sincerely yours MOMO Kejeiri,
Pardonnez mon français. J'ai besoin pratique. Je répéterai en anglais aussi. Je suspecte cela tablepersonnePhysique ne tient pas un object. :) WHEW !! Hope I didn't totally murder the language - back to english. I feel that you might not have called a new on the strongly typed ds tablepersonnePhysique. Hopefully you have declared the strongly typed ds, that is available as a class. Just like a regular dataset, you need to call a "new" on it. Also, you mentioned that you checked the defintion - i.e. If your strongly typed ds is tablepersonnePhysique, you need code like --- tablepersonnePhysique m_tablepersonnePhysique = new tablepersonnePhysique() ; ... then use m_tablepersonnePhysique to do your work .. remember the constraint will exist only in the instance, if you wish the constraint to exist regardless - you need to put that in the xsd for the strongly typed dataset. Regards, - Sahil Malik http://dotnetjunkies.com/weblog/sahilmalik Show quote "kejeiri" <keje***@yahoo.fr> wrote in message news:f07151af.0412080709.6c1c2149@posting.google.com... > When I use my Dll in which I defined my dataset the following error > occurs: > Object reference not set to an instance or (in French "Une exception > non gérée du type 'System.NullReferenceException' s'est > produite dans system.data.dll, Informations supplémentaires : La > référence d'objet n'est pas définie > à une instance d'un objet") is due to the use of this instruction : > > ... > .......... > Dim fkc As ForeignKeyConstraint > > Here ---> fkc = New ForeignKeyConstraint("personnePhysique_telephones",new > DataColumn(){Me.tablepersonnePhysique.personnePhysique_IdColumn}, new > DataColumn(){Me.tabletelephones.personnePhysique_IdColumn})<--- Here > > > Me.tabletelephones.Constraints.Add(fkc) > fkc.AcceptRejectRule = System.Data.AcceptRejectRule.None > fkc.DeleteRule = System.Data.Rule.Cascade > fkc.UpdateRule = System.Data.Rule.Cascade > . > ......... > ..... > > I checked the definition of all objects and apparently are well > defined. > Please what's wrong? Above u've whole code of my application > > Sincerely yours > > MOMO Sahil,
> Pardonnez mon français. J'ai besoin pratique. Je répéterai en anglais Ik zal volgende keer alles in het Nederlands aan je vragen, misschien kan > aussi. > Je suspecte cela tablepersonnePhysique ne tient pas un object. :) Miha het dan in het Sloveens doen, kan je nog wat meer oefenen. Nastempnym razem spytam Cebie po holdendersku, moze Miha napisze po slovensku, to moze bedziesz mógt troche pocwiczyc. Miha, to jest po polsku. :-) CorUr French is very good and ur dutch too!!! but my dutch is even worse
than chinese... BR MOMO *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! Cor,
Mijn Nederlands is werkelijk slecht :-) Mijn Engels is nog slechter. If you ask me questions in Dutch, tey mein terre sawalan da jawab punjabi wich deyangaa (If you ask me questions in dutch, then I will reply your questions in punjabi). CHAK DEY FATTE !! :-P Slovenian - now that's beyond me man !!! Whats the translation? - Sahil Malik http://dotnetjunkies.com/weblog/sahilmalik PS: We're really going OT here, hope the Microsoftie's don't mind !! Show quote "Cor Ligthert" <notmyfirstn***@planet.nl> wrote in message news:O#YcM#T3EHA.4064@tk2msftngp13.phx.gbl... > Sahil, > > > Pardonnez mon français. J'ai besoin pratique. Je répéterai en anglais > > aussi. > > Je suspecte cela tablepersonnePhysique ne tient pas un object. :) > > Ik zal volgende keer alles in het Nederlands aan je vragen, misschien kan > Miha het dan in het Sloveens doen, kan je nog wat meer oefenen. > > Nastempnym razem spytam Cebie po holdendersku, moze Miha napisze po > slovensku, to moze bedziesz mógt troche pocwiczyc. Miha, to jest po polsku. > > :-) > > Cor > > Thank u for ur answers... Well the problem are realy complecated...
indeed my object reference has an early created but the problem carry on !!!... Below u've the link to the complete code : http://www.geocities.com/mkejeiri/completeCode.txt Use ctr-f and look for pattern "here", the code when the error occurs, is delimited as illustrated below: 'here .... 'end here Many thanks MOMO. *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! Momo,
I presume that's the code for your strongly typed dataset. Did you generate it out of an XSD? Can we see that XSD also? - Sahil Malik http://dotnetjunkies.com/weblog/sahilmalik Show quote "mohamed larbi kejeiri" <keje***@yahoo.fr> wrote in message news:#QhbfaU3EHA.3472@TK2MSFTNGP09.phx.gbl... > Thank u for ur answers... Well the problem are realy complecated... > indeed my object reference has an early created but the problem carry on > !!!... > Below u've the link to the complete code : > > http://www.geocities.com/mkejeiri/completeCode.txt > > Use ctr-f and look for pattern "here", the code when the error occurs, > is delimited as illustrated below: > 'here > ... > 'end here > > Many thanks > MOMO. > > *** Sent via Developersdex http://www.developersdex.com *** > Don't just participate in USENET...get rewarded for it! Okay seeing the code made a difference.
It appears that you took a strongly typed dataset's cs code and customized that - which is a good experiment I'd never bet my life upon. But anyway - the problem is (and I had to remove all the System.Debugger.Stepthrough's so I could actually get to the real problem and it wasn't between 'here and 'end here). So the real problem is ---- In the datatable telephonesDataTable 's "InitClass", you forgot to include a definition for columnpersonnePhysique_Id, and when the following code runs Friend ReadOnly Property personnePhysique_IdColumn() As DataColumn Get Return Me.columnpersonnePhysique_Id End Get End Property ,,,,,,,,,,,,, It bombs !!! There you go .. Hope this would fix it, also when debugging this code, remove the System.Debugger.StepThrough's or you'd never zero in on the real problem. - Sahil Malik http://dotnetjunkies.com/weblog/sahilmalik Show quote "mohamed larbi kejeiri" <keje***@yahoo.fr> wrote in message news:#QhbfaU3EHA.3472@TK2MSFTNGP09.phx.gbl... > Thank u for ur answers... Well the problem are realy complecated... > indeed my object reference has an early created but the problem carry on > !!!... > Below u've the link to the complete code : > > http://www.geocities.com/mkejeiri/completeCode.txt > > Use ctr-f and look for pattern "here", the code when the error occurs, > is delimited as illustrated below: > 'here > ... > 'end here > > Many thanks > MOMO. > > *** Sent via Developersdex http://www.developersdex.com *** > Don't just participate in USENET...get rewarded for it! That was only one of the problems ... after that I am running into some sort
of problem with how Friend classes behave. Seeing the original XSD would help a lot. (Or maybe a diagram of how you intend all your datatables and relations to look). Any reason you had to modify autogenerated code? - Sahil Malik http://dotnetjunkies.com/weblog/sahilmalik Show quote "Sahil Malik" <contactmethrumyblog@nospam.com> wrote in message news:OtUjBeW3EHA.1396@tk2msftngp13.phx.gbl... > Okay seeing the code made a difference. > > It appears that you took a strongly typed dataset's cs code and customized > that - which is a good experiment I'd never bet my life upon. > > But anyway - the problem is (and I had to remove all the > System.Debugger.Stepthrough's so I could actually get to the real problem > and it wasn't between 'here and 'end here). > > So the real problem is ---- > > In the datatable telephonesDataTable 's "InitClass", you forgot to include a > definition for columnpersonnePhysique_Id, and when the following code runs > > Friend ReadOnly Property personnePhysique_IdColumn() As DataColumn > > Get > > Return Me.columnpersonnePhysique_Id > > End Get > > End Property > > ,,,,,,,,,,,,, It bombs !!! > > There you go .. Hope this would fix it, also when debugging this code, > remove the System.Debugger.StepThrough's or you'd never zero in on the real > problem. > > - Sahil Malik > http://dotnetjunkies.com/weblog/sahilmalik > > > > "mohamed larbi kejeiri" <keje***@yahoo.fr> wrote in message > news:#QhbfaU3EHA.3472@TK2MSFTNGP09.phx.gbl... > > Thank u for ur answers... Well the problem are realy complecated... > > indeed my object reference has an early created but the problem carry on > > !!!... > > Below u've the link to the complete code : > > > > http://www.geocities.com/mkejeiri/completeCode.txt > > > > Use ctr-f and look for pattern "here", the code when the error occurs, > > is delimited as illustrated below: > > 'here > > ... > > 'end here > > > > Many thanks > > MOMO. > > > > *** Sent via Developersdex http://www.developersdex.com *** > > Don't just participate in USENET...get rewarded for it! > > Malik,
Well I'm not using CS language but the VB.net... can you briefly explain to me how u preceded to detect the error "missing statement in initClass()..." Well, I don't find System.Debugger.StepThrough... Do u mean System.Diagnostics.DebuggerStepThrough()? ...must be ignored? Best Regards. MOMO. *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! Momo,
Yes I mean System.Diagnostincs.DebuggerStepThrough() Essentially putting that on top of a portion of your code means - Vstudio is not going to debug thru there. By removing those, you'd be able to debug thru your class normally, and know the *real* place where the error is happening. I had to fix InitClass at a few places, but then I mentioned that I am running into a few problems with friend classes which is why I need to see the xsd. Anyway, when you remove the System.Diag.DST's , you'll know where the error is happening. - Sahil Malik http://dotnetjunkies.com/weblog/sahilmalik Show quote "mohamed larbi kejeiri" <keje***@yahoo.fr> wrote in message news:ewYZ81d3EHA.2676@TK2MSFTNGP12.phx.gbl... > Malik, > Well I'm not using CS language but the VB.net... can you briefly explain > to me how u preceded to detect the error "missing statement in > initClass()..." > Well, I don't find System.Debugger.StepThrough... Do u mean > System.Diagnostics.DebuggerStepThrough()? ...must be ignored? > Best Regards. > MOMO. > > > *** Sent via Developersdex http://www.developersdex.com *** > Don't just participate in USENET...get rewarded for it! sahil,
So, in the InitClass() (inside Class telephonesDataTable), the code must like that : ........ Private Sub InitClass() Me.columntelephones_Id = New DataColumn("telephones_Id", GetType(System.Int32), Nothing, System.Data.MappingType.Hidden) Me.Columns.Add(Me.columntelephones_Id) Me.columnacteur_Id = New DataColumn("acteur_Id", GetType(System.Int32), Nothing, System.Data.MappingType.Hidden) Me.Columns.Add(Me.columnacteur_Id) Me.columnpersonnePhysique_Id = New DataColumn("personnePhysique_Id", GetType(System.Int32), Nothing, System.Data.MappingType.Hidden) Me.Columns.Add(Me.columnpersonnePhysique_Id) Me.Constraints.Add(New UniqueConstraint("Constraint1", New DataColumn() {Me.columntelephones_Id}, True)) Me.columntelephones_Id.AutoIncrement = True Me.columntelephones_Id.AllowDBNull = False Me.columntelephones_Id.Unique = True End Sub ..... As for the xsd schema u can download it from : http://www.geocities.com/mkejeiri/MOMO.zip The msgEvenementsServeurActes.xsd is the root file... The schema is not normalized according the relational model… First, I decided to cut it in different level and generate a partial dataset using xsd.exe utility and then integrate the whole dataset mapping the schema :-)... Many thanks. *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! That fixed one of the problems .. there are more however .. let me get
around to this sometime today .. thanks for the xsd. - Sahil Malik http://dotnetjunkies.com/weblog/sahilmalik Show quote "mohamed larbi kejeiri" <keje***@yahoo.fr> wrote in message news:uHJC%23Zd3EHA.2288@TK2MSFTNGP11.phx.gbl... > sahil, > So, in the InitClass() (inside Class telephonesDataTable), the code must > like that : > ....... > > Private Sub InitClass() > Me.columntelephones_Id = New DataColumn("telephones_Id", > GetType(System.Int32), Nothing, System.Data.MappingType.Hidden) > Me.Columns.Add(Me.columntelephones_Id) > Me.columnacteur_Id = New DataColumn("acteur_Id", > GetType(System.Int32), Nothing, System.Data.MappingType.Hidden) > Me.Columns.Add(Me.columnacteur_Id) > Me.columnpersonnePhysique_Id = New > DataColumn("personnePhysique_Id", GetType(System.Int32), Nothing, > System.Data.MappingType.Hidden) > Me.Columns.Add(Me.columnpersonnePhysique_Id) > Me.Constraints.Add(New UniqueConstraint("Constraint1", New > DataColumn() {Me.columntelephones_Id}, True)) > Me.columntelephones_Id.AutoIncrement = True > Me.columntelephones_Id.AllowDBNull = False > Me.columntelephones_Id.Unique = True > End Sub > .... > > As for the xsd schema u can download it from : > http://www.geocities.com/mkejeiri/MOMO.zip > The msgEvenementsServeurActes.xsd is the root file... > The schema is not normalized according the relational model. > First, I decided to cut it in different level and generate a partial > dataset using xsd.exe utility and then integrate the whole dataset > mapping the schema :-)... > Many thanks. > > *** Sent via Developersdex http://www.developersdex.com *** > Don't just participate in USENET...get rewarded for it! |
|||||||||||||||||||||||