Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7973365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:04:51+00:00 2026-06-04T08:04:51+00:00

Please look at what is wrong? I want to convert datarow to a string

  • 0

Please look at what is wrong? I want to convert datarow to a string list.

 public List<string> GetEmailList()
    {
        // get DataTable dt from somewhere.
        List<DataRow> drlist = dt.AsEnumerable().ToList();
        List<string> sEmail = new List<string>();
        foreach (object str in drlist)
        {
            sEmail.Add(str.ToString()); // exception
        }
        return sEmail; // Ultimately to get a string list.
    }

Thanks for help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T08:04:52+00:00Added an answer on June 4, 2026 at 8:04 am

    There’s several problems here, but the biggest one is that you’re trying to turn an entire row into a string, when really you should be trying to turn just a single cell into a string. You need to reference the first column of that DataRow, which you can do with brackets (like an array).

    Try something like this instead:

    public List<string> GetEmailList()
    {
        // get DataTable dt from somewhere.
        List<string> sEmail = new List<string>();
        foreach (DataRow row in dt.Rows)
        {
            sEmail.Add(row[0].ToString());
        }
        return sEmail; // Ultimately to get a string list.
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please look at this image here is 3 tables , and out i want
Please look that alias name. I hope to set the value into a string
Please have a quick look below, what is wrong here? $tmp_img_path=../temp_images/; $name_image1=mypicture.jpeg; $new_img_path=../images/; rename($temp_img_path.$name_image1,
THis is myDB Class //Please take a look at public Cursor getplaces() --- Am
Hey guys, please take a look at my code and see what's wrong here.
Please look at the two examples below: irb(#<ActionView::Base:0x2863d58>):030:0> paintings_path => /some-nice-alias-path irb(#<ActionView::Base:0x2863d58>):029:0> self.controller_name.to_s +
Please look at : http://news.bbc.co.uk/2/hi/europe/8592380.stm The content updates automatically, however, I can't see it
Please look at the below code snippet and let me know how the out
Please look at this code: @interface myObject:NSObject -(void)function:(id)param; @end @implementation myObject -(void)function:(id)param { NSLog(@BEFORE);
Please look at this fiddle: http://jsfiddle.net/dyv88/16/ On IE7, if I put width: 100% on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.