Friday, October 3, 2014

MS SQL Get only date from datetime column

SELECT convert(varchar, getdate(), 100) – mon dd yyyy hh:mmAM (or PM)
                                        – Oct  2 2008 11:01AM          
SELECT convert(varchar, getdate(), 101) – mm/dd/yyyy 10/02/2008                  
SELECT convert(varchar, getdate(), 102) – yyyy.mm.dd – 2008.10.02           
SELECT convert(varchar, getdate(), 103) – dd/mm/yyyy
SELECT convert(varchar, getdate(), 104) – dd.mm.yyyy
SELECT convert(varchar, getdate(), 105) – dd-mm-yyyy
SELECT convert(varchar, getdate(), 106) – dd mon yyyy
SELECT convert(varchar, getdate(), 107) – mon dd, yyyy
SELECT convert(varchar, getdate(), 108) – hh:mm:ss
SELECT convert(varchar, getdate(), 109) – mon dd yyyy hh:mm:ss:mmmAM (or PM)
                                        – Oct  2 2008 11:02:44:013AM   
SELECT convert(varchar, getdate(), 110) – mm-dd-yyyy
SELECT convert(varchar, getdate(), 111) – yyyy/mm/dd
SELECT convert(varchar, getdate(), 112) – yyyymmdd
SELECT convert(varchar, getdate(), 113) – dd mon yyyy hh:mm:ss:mmm
                                        – 02 Oct 2008 11:02:07:577     
SELECT convert(varchar, getdate(), 114) – hh:mm:ss:mmm(24h)
SELECT convert(varchar, getdate(), 120) – yyyy-mm-dd hh:mm:ss(24h)
SELECT convert(varchar, getdate(), 121) – yyyy-mm-dd hh:mm:ss.mmm
SELECT convert(varchar, getdate(), 126) – yyyy-mm-ddThh:mm:ss.mmm

Saturday, September 20, 2014

How to programatically set an item in UltraComboEditor



UltraComboEditor1.DataSource = datatable1;

UltraComboEditor1.DisplayMember = "Caption";
UltraComboEditor1.ValueMember = "Values";

you can set value / selected value by below code.
UltraComboEditor.value = 1 // whatever in value member.


If you want to select Value from display member than you can use below code example.

UltraComboEditor.SelectedIndex = UltraComboEditor.FindString("DisplayValue"); // whatever in display member.



Friday, December 7, 2012

How to calculate age in Years,Months and Days crystal report form date of birth



Here DOB is Date of Birth.

Returns Year = DateDiff('yyyy',{DOB},CurrentDate())

Returns Months = DateDiff('m',{DOB},CurrentDate()) - (DateDiff('yyyy',{DOB},CurrentDate()) *12)

Returns Days =
DateDiff('d',{DOB},CurrentDate()) - ( (DateDiff('m',{DOB},CurrentDate()) / 12) * 365.25  )

Wednesday, October 10, 2012

ZXing QR barcode C# Example


BarcodeWriter BW = new BarcodeWriter();
BW.Format = BarcodeFormat.QR_CODE;
var bitmap =BW.Write("This is Bar Code Text");

How to hide user readable text in code 128?


public class PureBarcodeRenderer : ZXing.Rendering.BitmapRenderer
{
   public override Bitmap Render(BitMatrix matrix, BarcodeFormat format, string content, EncodingOptions options)
   {
      return base.Render(matrix, format, null, options);
   }
}

var writer = new BarcodeWriter
                {
                   Renderer = new PureBarcodeRenderer(),
                   Format = BarcodeFormat.CODE_128,
                   Options = new EncodingOptions
                                  {
                                     Height = 100,
                                     Width = 300
                                  }
                            };
var image = writer.Write(content);

How to hide user readable text in code 128?


public class PureBarcodeRenderer : ZXing.Rendering.BitmapRenderer
{
   public override Bitmap Render(BitMatrix matrix, BarcodeFormat format, string content, EncodingOptions options)
   {
      return base.Render(matrix, format, null, options);
   }
}

var writer = new BarcodeWriter
                {
                   Renderer = new PureBarcodeRenderer(),
                   Format = BarcodeFormat.CODE_128,
                   Options = new EncodingOptions
                                  {
                                     Height = 100,
                                     Width = 300
                                  }
                            };
var image = writer.Write(content);

C# ZXing.Net Code 128 Bar Code Example


var writer = new BarcodeWriter
                {
                   Format = BarcodeFormat.CODE_128,
                   Options = new EncodingOptions
                                  {
                                     PureBarcode = true,
                                     Height = 100,
                                     Width = 300
                                  }
                            };
var image = writer.Write(content);