?
Solved

Binding a datagrid using 3 tier architecture and LINQ

Posted on 2013-05-16
4
Medium Priority
?
1,538 Views
Last Modified: 2013-05-22
I am just getting started with web applications and 3-tier-archtecture.    I worked through the article below and felt pretty confident.  However I cannot figure how to expand this knowledge to allow me to retrieve a block of data and bind to a datagridview.  

I get the stored procedures for Insert, Update and Delete, but how do I return a record set to bind my datagridview to?

Can anyone provide an example that would allow me further apply this?
http://www.c-sharpcorner.com/uploadfile/jayendra/how-to-create-3-tier-application-using-linq/
0
Comment
Question by:ITGuy4life
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 25

Expert Comment

by:apeter
ID: 39174009
The same link, has a sample project...did you try that ?
0
 
LVL 13

Expert Comment

by:Jitendra Patil
ID: 39174476
try the link given below

Data Binding using LINQ to SQL in C#

hope this helps.
0
 

Accepted Solution

by:
ITGuy4life earned 0 total points
ID: 39175416
Thanks Guys;

I got where I needed to be.  

The first article:  http://www.c-sharpcorner.com/uploadfile/jayendra/how-to-create-3-tier-application-using-linq/  provides a good overview on 3-tier applications using linq but doesn't address databinding.

The second article:  http://www.c-sharpcorner.com/UploadFile/lakshmanmcaj/using-linq-to-sql-query/  provides a good tutorial for databinding but does not follow the three tier architecture.

With both of those and a little help from a friend I was able to create the following function in my business layer:

public IEnumerable<myDataTable> GetDocs()
{
    using (MyDataContext db = new MyDataContext()
        {
            var result = db.MyDataTable();
            return result.ToList();
        }
}

And call it from my Page_Load event like this:

    var dt = new BusinessLogicLayer.MyBusinessLogicClass
    GridView1.DataSource = dt.GetDocs();
    GridView1.DataBind();
0
 

Author Closing Comment

by:ITGuy4life
ID: 39186874
I arrived at a solution through multiple sources.  My response contains all of the pieces necessary to solve this problem.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is Waterfall Model? Waterfall model is the classic Software Development Life Cycle method practiced in software development process. As the name "waterfall" describes, this development is flowing downwards steadily like waterfall, i.e., procee…
Dependencies in Software Design In software development, the idea of dependencies (http://en.wikipedia.org/wiki/Coupling_%28computer_programming%29) is an issue of some importance. This article seeks to explain what dependencies are and where they …
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question