Since I am new to working a C# 2010 console application, I have the following questions to ask about how to accomplish the following tasks:
1. I would like to use linq to sql on a sql server 2008 r2 database to pull all the data from one column in one particular table. The value for the one array would be varchar(50) There will be more than one row selected at the time. (What I have seen of linq so far is to pull only one value by using singleordefault.)
2. I then would like to take the values obtained from step number one and load those values into array,collection, or some type of similar object.
Can tell me how to accomplisth this goal and/or point me to a reference that I can use?
Loading

VulpesRank #55 · 29.2K reputationPosted Sep 6, 2012, 9:01 AM EDT
VulpesRank #55 · 29.2K reputationPosted Sep 6, 2012, 6:20 AM EDT
dcRank #2,247 · 627 reputationPosted Sep 6, 2012, 7:20 AM EDT
Now how would I access each item (names) in the array?
VulpesRank #55 · 29.2K reputationPosted Sep 6, 2012, 7:35 AM EDT
Just access them as you normally would - so names[0] is the first name in the array, names[1] is the second and so forth.
To make sure it's giving the right answers you could iterate the array as follows:
foreach(string name in names) Console.WriteLine(name);
dcRank #2,247 · 627 reputationPosted Sep 6, 2012, 8:39 AM EDT
string[] names
= context.Customers.Select(c => c.Name).ToArray();
How would I change this statement to mean the following from the sql?
select customer_id from Customers where customer_received_date is not null