Using linq to SQL in ASP.NET with DAL
How do you get the data from an SQL Table using Linq by way of a Data Access Layer? I've seen numerous articles that show how to get the specific fields, but they all do console.writeline at the end. I want to bind the data to a textbox or label, or both. I can get 1 field OK by this:
int numberfld = GetData.getRecord(ID); which calls the method in the DAL and returns the value.
So, how do you go about returning the data for more than 1 column from the DAL so it can be used to populate any number of textboxes or labels? I've made it work using a foreach, but that seems like poor coding technique when I only want one row.
4 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Matt Slay10 pointsPosted Nov 20, 2009, 4:51 PM EST
Dale Hermsen9 pointsPosted Nov 21, 2009, 8:26 AM EST
Matt Slay10 pointsPosted Nov 21, 2009, 9:19 AM EST
Matt Slay10 pointsPosted Nov 21, 2009, 9:55 AM EST