Link to home
Start Free TrialLog in
Avatar of SimonPrice33
SimonPrice33

asked on

c# foreach dr in datatable

Hi Experts

I am in a transition period from VB.Net to C# and am stuck on getting data from a data table so that I can build it into a CSV file.

What I have at the moment is

foreach (DataRow dr in dt.Rows );
                    {

                        EmirSB.Append(dr.item(1) + ",");
                        EmirSB.Append(dr.item(2) + ",");
                        EmirSB.Append(dr.item(3) + ",");

                     }

Open in new window


however i am getting an error the name dr does not exist in the current context.

Where should i place this please?

thanks

Simon
ASKER CERTIFIED SOLUTION
Avatar of Ganapathi
Ganapathi
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of SimonPrice33
SimonPrice33

ASKER

thank you