
Chapter 6: Debugging with Visual Studio | 173 |
look at is much fewer and you can save time. If you have multiple records, you can press F5 and the breakpoint will pause on each record, allowing you to inspect the value. In this case, the record set is so small that we hit the right record immediately.
7.Press F10 to step over the if condition. This will tell us whether the condition is being evaluated properly. In this case, VS does not step into the if statement but instead moves to the end of the if statement, meaning that searchName and cust.FirstName are not equal. This means you need to take a closer look at cust.FirstName to see what the problem is with the data.
8.Next, we’ll use a couple of the VS debugger tools to inspect cust.FirstName and find out why the equality check is not working. Open the Immediate window
cust.FirstName
which will return this:
"Jean "
Here, you can see that the result has a trailing
9.Open a Memory window
The layout of the Memory window starts with an address on the left, which is scrolled down to the line where the data in cust.FirstName variable first appears. In the middle is the hex representation of the data. The final column has a readable