none
linq to sql convering a list to a list of string RRS feed

  • Question

  • i have a function in my wcf service like this:

    public List<MyEmployee> FindEmployee(string uid)

            {

                DataClasses1DataContext context = new DataClasses1DataContext();

                var res = from r in context.MyEmployees where r.EmpID == uid select r;

                return res.ToList();

            }

    i want to convert that list to alist of string and return it within this function,,how to do that?

    • Moved by Naomi N Wednesday, March 20, 2013 10:16 PM Better answer can be here
    Wednesday, March 20, 2013 8:39 AM

Answers

  • I agree this is in the wrong forum, but in the mean time :

    public List<string> FindEmployee(string uid) 
            { 
                DataClasses1DataContext context = new DataClasses1DataContext(); 
                var res = from r in context.MyEmployees where r.EmpID == uid select r.ToString(); 
                return res.ToList(); 
            } 

    Wednesday, March 20, 2013 9:11 AM

All replies

  • I believ the question has a scope in .NET forums than SQL Server.

    Please move/ask the question in .NET forum, you will be getting better help from there.


    Please use Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful.

    Wednesday, March 20, 2013 8:44 AM
  • I agree this is in the wrong forum, but in the mean time :

    public List<string> FindEmployee(string uid) 
            { 
                DataClasses1DataContext context = new DataClasses1DataContext(); 
                var res = from r in context.MyEmployees where r.EmpID == uid select r.ToString(); 
                return res.ToList(); 
            } 

    Wednesday, March 20, 2013 9:11 AM