Skip to content

Archive

Archive for October 19th, 2009

Import System.Text.RegularExpressions namespace.

using System.Text.RegularExpressions;
public bool IsEmailValid(string Address)
{
    string pattern = @"^(([^<>()[\]\\.,;:\s@""]+"
          + @"(\.[^<>()[\]\\.,;:\s@""]+)*)|("".+""))@"
          + @"((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}"
          + @"\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+"
          + @"[a-zA-Z]{2,}))$";
    Regex rest = new Regex(pattern);
    bool isrest Match = rest .IsMatch(Address);
    return isrest;
}

Sometimes we need to empty table.

DELETE FROM <TABLE name>

The following code to run on it:

DBCC CHECKIDENT (<TABLE name>, RESEED, 0)

You can use truncate table only if there are no contrains and foreign keys related with this table.

Import System namespace.

using System;

Convert Degrees To Radians

public static double CDTR(double degrees)
{
    return ((Math.PI / 180) * degrees);
}

Convert Radians To Degrees

public static double CRTD(double radians)
{
    return ((180 / Math.PI) * radians);
}

Slider by webdesign