LINQ in ASP#
LINQ in ASP#
BindGridview(0);
}
}
1|Page
ASP.NET LINQ to SQL Using C# Lab Manual
}
catch (Exception ex)
{
lblMsg.Text = "Record inserted Failed!";
}
catch (Exception ex)
{
lblMsg.Text = "Record Updated Failed!";
}
}
2|Page
ASP.NET LINQ to SQL Using C# Lab Manual
}
catch (Exception ex)
{
lblMsg.Text = "Record Deleted Failed!";
}
}
}
}
Select
Presentation Layer
<table><tr><td>
<asp:GridView runat="server" ID="SelectData" onp></asp:GridView>
</td></tr></table>
Code Behind for Select
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Onrtire
{
public partial class LINQSelect : System.Web.UI.Page
{
StudentDBDataContext db = new StudentDBDataContext();
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
BindGridview(0);
}
}
//LINQ to SQL Select Operation
3|Page
ASP.NET LINQ to SQL Using C# Lab Manual
SelectData.DataSource = db.SE_Linq();
SelectData.DataBind();
db.Dispose();
}
}
}
4|Page