Solved

Binding a datagrid using 3 tier architecture and LINQ

Posted on 2013-05-16
4
1,515 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

Technology Partners: 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

Software development teams often use in-memory caches to improve performance. They want to speed up access to, or reduce load on, a backing store (database, file system, etc.) by keeping some or all of the data in memory.   You should implement a…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

695 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