4
Answers

Using linq to SQL in ASP.NET with DAL

Dale Hermsen

Dale Hermsen

14y
3.9k
1
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)