2014年7月13日 星期日

[RESOLVED] Codes not executed


Hi,

I do put one breakpoint on "conn.Open()" line below and when the project has been executed, I see the value of tb_fld6 is not empty and this Textbox is filled with a value before the following codes. However, the Open() line below is not executed at all. Why?


if (tb_fld6.Text.Trim() != "")
{
try
{
conn.Open();
...







Hi,


Can you give whole code.


Thanks.



I think I have mentioned it clearly: right before the current part of codes, the Textbox has been assigned with a value, and this is the only place by which it is assigned with a value, in the whole project. Why weren't the above part be fired?



If you are putting the Breakpoint on the conn.Open(); line and the Breakpoint is been hit so you can see the value of tb_fld6.Text, it means that conn.Open() is executing.  It could be a problem with your connection string.  Are you catching an error?  Comment
out the try..catch block to see what happens.



No, I mentioned that the Open() line above is not executed, while the Textbox is having a value. Why?


Upon that the breakpoint is reached, how can I see the value of that Textbox? There is only one place to assign a value to this Textbox, which is before this "If" line.



Hi,




wmec



if (tb_fld6.Text.Trim() != "")




try adding the breakpoint on above code to check if the breakpoint is hitted and the value of the tb_fld6.Text.


Hope it can help you



I added breakpoint to this and the Open() line, but the "If" line is hit and the Open() line is not. At the time "If" is hit, how to see the relevant value of this Textbox?



Are you asking for how to see the value in textbox? If so


While executing and reached at break point you can see value by selecting tb_fld6.Text.Trim() and right click nd select Add Watch or Quick Watch.Or just on mouse over to tb_fld6.Text while running



At the time "If" is hit (the breakpoint is reached), how to see the relevant value of this Textbox?



Hi,


You can use Quickwatch dialog box to see the value of textbox while in bread mode. For detailed information, you can refer here


http://msdn.microsoft.com/en-us/library/cyzbs7s2.aspx


http://www.dotnetperls.com/debugging


Hope it can help you


 





wmec



At the time "If" is hit (the breakpoint is reached), how to see the relevant value of this Textbox?





When the Breakpoint is hit, hover the mouse over the word Text in
tb_fld6
.Text.Trim()   The Text of tb_fld6 will display.  It sounds like the TextBox is empty or has spaces,
that is why conn is not opened.  Without more code, as mr.rahulmaurya suggested, it makes it almost impossible to help you with your issue.


沒有留言:

張貼留言