Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Apr 28, 2012 09:41 PM|LINK
I'm building a MVC3 app. Can I use "ToArray()" to make a db selection result into an array? Here is an example:
for (int i = 0; i < 5; i++)
var rows = from c in db.Table1
string newArray = new string;
newArray = rows.ToArray();
Question: Is this correct? If not, how do I acheive what I want? I want to put the values in rows into an array.
int i = 0;
foreach (var item in XYZ)
newArray[i] = item;
Is this correct?
Note: for both implementations above, I can compile the app, but when I run it, I get this error:
The LINQ expression node type 'ArrayIndex' is not supported in LINQ to Entities.