Dale Hermsen

Dale Hermsen

  • NA
  • 14
  • 0

Using linq to SQL in ASP.NET with DAL

Nov 20 2009 12:16 PM
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.

Answers (4)