Solved

VB.Net - DataRow Declartion Assistance

Posted on 2012-12-31
3
472 Views
Last Modified: 2012-12-31
Good Day Experts!

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?

Thanks,
jimbo99999
0
Comment
Question by:Jimbo99999
3 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 38732708
this should work:
Declare sqlRSGetProcessing As DataRow 
For Each sqlRSGetProcessing In sqlRStbl.Rows
Next

Open in new window

0
 
LVL 17

Expert Comment

by:nepaluz
ID: 38732746
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

Open in new window

0
 

Author Closing Comment

by:Jimbo99999
ID: 38732758
Excellent...I would have been staring at my For Each line not realizing the answer was right there.

Thanks,
jimbo99999
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now