Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
rtutus
Aged Yak Warrior
522 Posts |
Posted - 2006-10-24 : 13:04:18
|
Pb: in windows form project, my debugger doesn t break in the child form that causes the error Hi,In my MDI form, I show another child form childfrm using childform.showWhen I run the code, the code breaks in the mdi form code:childform.show saying: object can't be cast from dbnull to other typesBut it skips the line of code in the child form that causes the error.It took me an hour (proceeding by elimination in the load handler of the child form) befor I found the line of code in Me.load of the child form: childform that was the cause of the error.the line was: myDataAdapter.Fill(ds,"mytable")My question pls:How could I have my debugger break into the the line of childform (myDataAdapter.Fill(ds,"mytable") instead of skipping it and just breaking in the parent MDI form code :childform.show() without giving me the line number of childform that cause the error.Thank you--------------------------------------------------------------------------------R.tutus |
|
rtutus
Aged Yak Warrior
522 Posts |
Posted - 2006-10-24 : 19:59:15
|
sorry the information was not complete. This is what actually happened:the child form childform has a dataset created by the designer along with the connection and the datadapter. then, always using the VS2003 I bound my text boxes and other controls of child form to the dataset table fields (the databinding instructions are inserted automatically by the designer).So the first time I instantiate the child form , i have no errors since my dataset is still empty.But when I call childform.show, in childform.load I fill my dataset.I guess it produces an error only after the CLR tries to bind the values to the textboxes and checkboxes of my form. So the error is not due to FillDatset but I think due to the binding process , resulting in my code breaking in childform.show rather than in the childform itself.Now here is my question : How can we locate the error (may be in the binding process) that causes the error inside childform code so that I take the necessary actions and correct the related column in the table. This has happened to me many times, and I always have to proceed by elimination to locate the error which takes me plenty of time.2/ Also let me know if there is any other best practice to avoid all this mess next time.Thank you very much. |
 |
|
snSQL
Master Smack Fu Yak Hacker
1837 Posts |
Posted - 2006-10-25 : 15:17:02
|
Have you tried just setting a breakpoint in the Form Load event in childform? |
 |
|
rtutus
Aged Yak Warrior
522 Posts |
Posted - 2006-11-04 : 22:35:21
|
i want it to break without putting a breakpoint. like when we have an error i a line and uning the project breaks automatically in that line although we dont put a breakpoint (may be I am not using the right work :break) it applies more to windows form aplications. |
 |
|
|
|
|
|
|