Thursday, April 3, 2014

Increase Max Pool Sze

public static string srConnectionString = "server=localhost;database=mydb;uid=sa;pwd=mypw;Max Pool Size=200;Min Pool Size=10;Polling =True; ";
Currently the max pool size is 100;

Wednesday, April 2, 2014

Date Formatting in C#

Example Usage

<%= String.Format("{specifier}", DateTime.Now) %>
@DateTime.Now.ToString("F")
@DateTime.Now.ToString("hh:mm:ss.fff")
SpecifierDescriptionOutput
dShort Date08/04/2007
DLong Date08 April 2007
tShort Time21:08
TLong Time21:08:59
fFull date and time08 April 2007 21:08
FFull date and time (long)08 April 2007 21:08:59
gDefault date and time08/04/2007 21:08
GDefault date and time (long)08/04/2007 21:08:59
MDay / Month08 April
rRFC1123 dateSun, 08 Apr 2007 21:08:59 GMT
sSortable date/time2007-04-08T21:08:59
uUniversal time, local timezone2007-04-08 21:08:59Z
YMonth / YearApril 2007
ddDay08
dddShort Day NameSun
ddddFull Day NameSunday
hh2 digit hour09
HH2 digit hour (24 hour)21
mm2 digit minute08
MMMonth04
MMMShort Month nameApr
MMMMMonth nameApril
ssseconds59
fffmilliseconds120
FFFmilliseconds without trailing zero12
ttAM/PMPM
yy2 digit year07
yyyy4 digit year2007
:Hours, minutes, seconds separator, e.g. {0:hh:mm:ss}09:08:59
/Year, month , day separator, e.g. {0:dd/MM/yyyy}08/04/2007
.
Reference: http://www.mikesdotnetting.com/Article/23/Date-Formatting-in-CSharp
milliseconds separator

Enter Only Numbers in Textbox in c#

private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
    if (!char.IsControl(e.KeyChar) 
        && !char.IsDigit(e.KeyChar) 
        && e.KeyChar != '.')
    {
        e.Handled = true;
    }

    // only allow one decimal point
    if (e.KeyChar == '.' 
        && (sender as TextBox).Text.IndexOf('.') > -1)
    {
        e.Handled = true;
    }
}