Posts

Showing posts from December, 2011

C# - DateTime To String

String _display = DateTime.Now.ToString("dd/MM/yyyy"); _display result is: 27/12/2011 You can display by .NET Datetime format characters as the following: d - Numeric day of the month without a leading zero. dd - Numeric day of the month with a leading zero. ddd - Abbreviated name of the day of the week. dddd - Full name of the day of the week. f,ff,fff,ffff,fffff,ffffff - Fraction of a second. The more Fs the higher the precision. h - 12 Hour clock, no leading zero. hh - 12 Hour clock with leading zero. H - 24 Hour clock, no leading zero. HH - 24 Hour clock with leading zero. m - Minutes with no leading zero. mm - Minutes with leading zero. M - Numeric month with no leading zero ex.2. MM - Numeric month with a leading zero ex.02. MMM - Abbreviated name of month ex.Dec MMMM - Full month name ex.December. s - Seconds with no leading zero. ss - Seconds with leading zero. t - AM/PM but only the first letter. tt - AM/PM ( a.m. / p.m...

MSSQL - Set permission to update database MSSQL2008

In MSSQL2008 Server, when you change/edit table schema, sometimes you can not save change. The error you found is " Saving change is not permitted . The changes you have made require the following tables to be dropped and re-created....." You can fixed this problem with this solution. Solution: - In SQL Server Management Studio > Go to Tools Menu > Options > Designers - Find the option "Prevent saving changes that require a table re-creation" and unchecked it. Now, you can save changed your new schema.

C# - Convert Image URL To BASE64

public String ConvertImageURLToBase64(String url) {      StringBuilder _sb = new StringBuilder();      Byte[] _byte = this.GetImage(url);      _sb.Append(Convert.ToBase64String(_byte, 0, _byte.Length));      return _sb.ToString(); } private byte[] GetImage(string url) {      Stream stream = null;      byte[] buf;      try      {           WebProxy myProxy = new WebProxy();           HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);           HttpWebResponse response = (HttpWebResponse)req.GetResponse();           stream = response.GetResponseStream();  ...