Wednesday, 14 October 2009

oledbdatareaderclass

http://authors.aspalliance.com/aspxtreme/sys/Data/oledb/oledbdatareaderclass.aspx

vbcr in c#

System.Environment.NewLine

Single Quotes

HttpUtility.HtmlEncode(mystring.Replace("'", "")

Tuesday, 13 October 2009

Data Binder Prefix

<%# "prefix " + Eval("random") %>

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


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>

Monday, 17 August 2009

SET NOCOUNT ON

SET IDENTITY_INSERT [dbo].[tblEcommunicationsEmailTemplates] ON
GO


PRINT 'Inserting values into [tblEcommunicationsEmailTemplates]'
INSERT INTO (ID) VALUES(2)

PRINT 'Done'

SET IDENTITY_INSERT [dbo].[tblEcommunicationsEmailTemplates] OFF
GO
SET NOCOUNT OFF

Monday, 1 June 2009

Sunday, 31 May 2009

SQL - Useful Functions

Get Employees first name:

SELECT SUBSTRING(Name, 1, CHARINDEX(' ', Name)) AS FirstName

Friday, 22 May 2009

System.Web.HttpContext

System.Web.HttpContext.CurrentContext.Response.Write("");

System.Web.HttpContext.Current.User.Identity.IsAuthenticated