I am looking for assistance with my DataRow declaration. Right now I have it declared in my For Next Loop:
For Each sqlRSGetProcessing As DataRow In sqlRStbl.Rows
Next
This works great with no issues. After the Next, I am trying to reference the DataRow in a line of code for a messageBox in event there is an error. However, it tells me the DataRow is not declared.
So, up above the For statement I declare it. That makes the issue about it not being delcared go away in my code for the messageBox. But the "For Each sqlRSGetProcessing As DataRow In sqlRStbl.Rows" line barks at me saying the DataRow is alread delcared.
How can I make the DataRow in the For statement visible to the code below it?
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
The above answer should address your query, however it will contain the last row in the table, whereas the error you want to notify of may indeed be in another row within the table. In which case, stick to your original code and simply handle your messagebox inside a try catch, e.g
For Each sqlRSGetProcessing As DataRow In sqlRStbl.Rows Try 'here do your processing Catch ex As Exception 'here put your messagebox End Try Next
Excellent...I would have been staring at my For Each line not realizing the answer was right there.
Thanks,
jimbo99999
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
Open in new window