Group Discounts available for 3+ students and Corporate Clients

Accessing stored procedures using LINQ in

Accessing stored procedures using LINQ

Open ServerExplorer

Open NorthWindDataConnection

Drag & drop CustOrderList (Stored Procedure) on Form (which contains tables we drag & dropped (cust, order, – – – -))

(The stored procedure we already have)

Rclick anywhere on design and click ShowMethodSpan. Now a window will be opened showing all stored procedure


Note: The above steps will add the definition of the stored procedure with LINQ to sql classes.


The stored procedure used in LINQ:


@ Customer ID nchar (5)


SELECT Product Name, Total = SUM   – – >  (quantity)

FROM ProductsP, [Order details] Od, Orders O, Customers c

WHERE C.CustomerID = @ Customer ID

AND C.CustomerID = O.CustomerID

AND O.OrderID = OD.OrderID AND

OD.ProductID = D.ProductID

GROUP BY Product Name

Click on GridView2 task and edit columns

Expand Command Field à Select à Add

Button type: button

SelectText: ShowOrders

Double click on GridView2


String cid;

TableCell tcCID = (TableCell) GridVIew2. SelectedRow. Cells [3];

cid = tcCID.Text;

Response.Redirect (“ShowOrdersHistoryByCID.aspx? cid = “ + cid);

Website [menu] – – >Add NewItem – Name: ShowOrdersHistoryByCID

Place a GridView Control


// Page_Load

String CustomerId = request.QueryString [“cid”];

NorthWindDBDataContext dc = new NorthWindDBDataContext ();

Var ordersHistory = dc.CustOrderHist (CustomerId);

GridView1.DataSource = orderHistory;

GridView1.DataBind ();

“At TekSlate, we are trying to create high quality tutorials and articles, if you think any information is incorrect or want to add anything to the article, please feel free to get in touch with us at, we will update the article in 24 hours.”

0 Responses on Accessing stored procedures using LINQ in"

Leave a Message

Your email address will not be published. Required fields are marked *


Please Enter Your Details and Query.
Three + 6