0% found this document useful (0 votes)
31 views4 pages

Ex 7

The document outlines a program that utilizes Language Integrated Query (LINQ) to create a student table with fields for roll number, name, address, and fees. It includes an XML representation of student data and a C# code snippet that loads this XML data into a GridView on a web page. The program is designed to display student information dynamically from the XML file.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views4 pages

Ex 7

The document outlines a program that utilizes Language Integrated Query (LINQ) to create a student table with fields for roll number, name, address, and fees. It includes an XML representation of student data and a C# code snippet that loads this XML data into a GridView on a web page. The program is designed to display student information dynamically from the XML file.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Ex. No: 7 Write a Program using Language Integrated query.

Create the table with the


given fields. FIELD NAME DATA TYPE SRollno int, SName string, SAddress string and
SFees int.
Date:

Aim:

Alogorithm:
Output:
student.xml
<?xml version="1.0" encoding="utf-8" ?>
<TYStudents>
<student>
<srollno>1</srollno>
<sname>swati</sname>
<saddress>Wadala</saddress>
<sfees>1000</sfees>
</student>
<student>
<srollno>2</srollno>
<sname>natasha</sname>
<saddress>Dadar</saddress>
<sfees>3000</sfees>
</student>
</TYStudents>

Defaultst.aspx.cs
using System;
using System.Collections.Generic; using System.Linq;
using System.Web; using System.Web.UI; using System.Xml.Linq;
using System.Web.UI.WebControls;
public partial class Defaultst : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
XDocument xmlDoc = XDocument.Load(HttpContext.Current.Server.MapPath("student.xml"));
var studs = from s in xmlDoc.Descendants("student") select s;
GridView1.DataSource = studs; GridView1.DataBind();
}
}
Result:

You might also like