Wednesday, 14 October 2009
oledbdatareaderclass
http://authors.aspalliance.com/aspxtreme/sys/Data/oledb/oledbdatareaderclass.aspx
Tuesday, 13 October 2009
Monday, 12 October 2009
How To: Reading and Writing Text Files
Writing to a Text File
Listing 1: Writing Text Data to a File: TextFileWriter.cs
Reading From a Text File
Listing 2 shows how to read from a text file:
Listing 2: Reading Text Data from a File: TextFileReader.cs
Listing 1: Writing Text Data to a File: TextFileWriter.cs
using System;
using System.IO;
namespace csharp_station.howto
{
class TextFileWriter
{
static void Main(string[] args)
{
// create a writer and open the file
TextWriter tw = new StreamWriter("date.txt");
// write a line of text to the file
tw.WriteLine(DateTime.Now);
// close the stream
tw.Close();
}
}
}
Reading From a Text File
Listing 2 shows how to read from a text file:
Listing 2: Reading Text Data from a File: TextFileReader.cs
using System;
using System.IO;
namespace csharp_station.howto
{
class TextFileReader
{
static void Main(string[] args)
{
// create reader & open file
Textreader tr = new StreamReader("date.txt");
// read a line of text
Console.WriteLine(tr.ReadLine());
// close the stream
tr.Close();
}
}
}
URL Rewriting in >NET
<urlMappings configSource="Mapping.xml" />
Mapping.xml
<?xml version="1.0" encoding="utf-8" ?>
<urlMappings>
<add url="~/Page1.aspx" mappedUrl="~/Default.aspx?ID=1" />
<add url="~/Page2.aspx" mappedUrl="~/Default.aspx?ID=2" />
</urlMappings>
Mapping.xml
<?xml version="1.0" encoding="utf-8" ?>
<urlMappings>
<add url="~/Page1.aspx" mappedUrl="~/Default.aspx?ID=1" />
<add url="~/Page2.aspx" mappedUrl="~/Default.aspx?ID=2" />
</urlMappings>
Subscribe to:
Comments (Atom)