Sunday, September 11, 2011

Saturday, August 13, 2011

Creating a Simple XML Document ASP.net

namespace WriteToXML
{
using System;
using System.Xml;
///
/// Summary description for Class1.
///

public class Class1
{
public Class1()
{
}
public static int Main(string[] args)
{
try
{
// Creates an XML file is not exist
XmlTextWriter writer = new XmlTextWriter("C:\\temp\\xmltest.xml", null);
// Starts a new document
writer.WriteStartDocument();
//Write comments
writer.WriteComment("Commentss: XmlWriter Test Program");
writer.WriteProcessingInstruction("Instruction","Person Record");
// Add elements to the file
writer.WriteStartElement("p", "person", "urn:person");
writer.WriteStartElement("LastName","");
writer.WriteString("Chand");
writer.WriteEndElement();
writer.WriteStartElement("FirstName","");
writer.WriteString("Mahesh");
writer.WriteEndElement();
writer.WriteElementInt16("age","", 25);
// Ends the document
writer.WriteEndDocument();
}
catch (Exception e)
{
Console.WriteLine ("Exception: {0}", e.ToString());
}
return 0;
}
}
}









Write a LINQ query for a dataset

Public Class Test
Shared Sub main()
'Data set to store the value
Dim dset As New DataSet()

'Data table
Dim dt As New DataTable

'Adding columns to data table
dt.Columns.Add("Name", GetType(String))
dt.Columns.Add("ID", GetType(Integer))
dt.Columns.Add("Address", GetType(String))

'Adding rows to the data table
dt.Rows.Add("Asha", "1", "Tumkur")
dt.Rows.Add("Usha", "2", "Bangalore")
dt.Rows.Add("Ashok", "3", "")
dt.Rows.Add("", "4", "Mysore")
dt.Rows.Add("", "5", "")

'Adding data table to the Data set
dset.Tables.Add(dt)


'LINQ to get required data
Dim DataWithName = From detail In dset.Tables(0) Where detail.Item("Name") IsNot String.Empty Select detail
Dim DataWithOutName = From detail In dset.Tables(0) Where detail.Item("Name") Is String.Empty Select detail

Dim DataWithAddress = From detail In dset.Tables(0) Where detail.Item("Address") IsNot String.Empty Select detail
Dim DataWithotAddress = From detail In dset.Tables(0) Where detail.Item("Address") Is String.Empty Select detail

'Displying the result
For Each rows As DataRow In DataWithName
Console.WriteLine(rows.Item("Name"))
Next

Console.ReadLine()
End Sub

End Class

Using LINQ with ASP.NET

Step 1: Creating your first ASP.NET page using LINQ

Create a new page called Step1.aspx. Within the .aspx page add a GridView control like so:



using System;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Query;

public partial class Step1 : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

string[] cities = { "London", "Amsterdam", "San Francisco", "Las Vegas",

"Boston", "Raleigh", "Chicago", "Charlestown",

"Helsinki", "Nice", "Dublin" };

GridView1.DataSource = from city in cities

where city.Length > 4

orderby city

select city.ToUpper();

GridView1.DataBind();

}

}


LISQ Query with Where


using System;

using System.Query;

public partial class Data_Data2 : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

Northwind db = new Northwind();

GridView1.DataSource = from x in db.Suppliers

where x.Country == "USA"

orderby x.Country

select new {

x.CompanyName,

x.Country,

x.Products

};

GridView1.DataBind();

}

}

ابن انشا : 1927ء - 1978ء: دل عشق میں‌بے مایاں ، سودا ہو تو ایسا ہو

ابن انشا : 1927ء - 1978ء: دل عشق میں‌بے مایاں ، سودا ہو تو ایسا ہو


Wednesday, May 11, 2011

طوفان

لوگ ہمیشہ طوفان سے پہلے والی خاموشی کی بات کرتے ہیں .
پر طوفان ک بعد والی خاموشی کی بات کوئی نہیں کرتا
کم سے کم طوفان ک بعد اپ کو یقین ہوتا ہے کہ طوفان تھم گیا ہے 
کیوں کے میں نہ اپنی زندگی اکیلے رہ کر گزاری ہے .
پر اکیلے رہنے کا کوئی  فائدہ نہیں ہے 
کیوں کے آپ چاہیے لوگوں سے کتنا ہی دور ہوں، ان کا شور اپ کی اکیلے پن کو مٹا دیتا ہے  

اتنا ہی چاہتی تھی کے کسی کو دیکھائی نہ دوں

Tuesday, April 19, 2011

عجیب اپنی یہ زندگی ہے

عجیب اپنی یہ زندگی ہے
سمیٹو جتنا بکھر رہی ہے

ہم ایک پل کو بھی جی نہ پائے
یہ لمحہ لمحہ گزر رہی ہے

عجیب اپنی یہ زندگی ہے
ہیں خواہشوں کے ہی پیچھے بھاگے

حسرتوں کو گلے لگائے
یہ آج آنکھوں میں جو نمی ہے
یہ اپنے خوابوں کی بے بسی ہے


دلوں کی باتیں جو کہ نہ پا یے
ہمارے آنسو جو بہ نہ پا یے
تمہارے جانے کی بعد ہم بھی کہیں
سکوں سہ کہی رہ نہ پا یے
ہر ایک راستے پر روک رہی ہے
ہماری چاہت بھٹک رہی ہے
عجیب اپنی یہ زندگی ہے

Saturday, April 16, 2011

کشتیاں جلا آیے -

ہم جو  کشتیاں پیچھے چھوڑ اتے ہیں
ان پر پھر سے سوار ہونے میں ڈرتے ہیں
تو اس سے کوئی فرق نہیں پڑتا کے
پیچھے کوئی کشتی باقی بچی ہے یا نہیں .