Reputation: 536
I have the following piece of code
_Foo = String.Concat(_Foo, " Var = '", _varValue, "' ")
_Bar = DsInvoice.viewInvoice.Select(_Foo, _Order)
If _Bar.Count > 0 Then
When I place the debug lines, the Dataset is actually returning rows, and _Bar has a count of 116. Yet when it is at the 3rd line (the if statement) _Bar is empty and the count returns 0. Without any reason I just lost my data.
Let me know if you need more information (I'm actually a PHP programmer and I had to fix a legacy bit of code :(. I lack VB experience to give more background information on this code.
Upvotes: 0
Views: 46
Reputation: 65672
_Bar
has no rows because there is no value equal to the _varValue in the "Column" (a.k.a "Property") in the datatable.
*Even if the Property is numeric I doubt wrapping it with single quotes will matter. *
Tip: F8 (VB.Net) or F11 (C#) to step the code control (Yellow Line) onto the second line of code. Then hover your mouse over the viewInvoice
word on the second line shown in your question, you'll see the ObjectBrowser Tooltip appear and in it will be a Magnifying Glass with a dropdown. Click it (the dropdown) and select the DataTable View to help you debug this problem.
You can change the Select(...)
criteria in run/debug time and then (by dragging the yellow arrow in the line number margin up a line) see the effect of the different Select
criteria to work out what is going wrong.
Upvotes: 1