Wednesday, May 23, 2012

Publish Windows Service

1. open command prompt from start->Accessories->Command promopt Note: Right click and click "Run as administrator"
2. Type & run cmd .netframework installed path "cd C:\Windows\Microsoft.NET\Framework\v4.0.30319"
3. Type & run cmd for install service "installutil -i "drivepath\WindowsService.exe""
4. Open run dialog and type "services.msc" it will open services
5. Find "Service Name" & start service

Friday, May 11, 2012

Appending Values to Datatable in Loop

   DataTable results = new DataTable();

   foreach (string somevalue in somecondition)
   {

        DataTable toMerge = new DataTable();
        
        toMerge = // Some code to get datatable values

        results = results.Merge(toMerge);

    }

Monday, May 7, 2012

OCR Conversion - Image to Text

  Reference :
  ========

  .Net -> COM -> Interop.MODI.dll

  Code :
  =====

  MODI.Document doc = new MODI.Document();
  doc.Create(filePath);
  doc.OCR(MODI.MiLANGUAGES.miLANG_ENGLISH, false, false);
  string result = ((MODI.Image)doc.Images[0]).Layout.Text;

Friday, May 4, 2012

Copy selected columns from one DataTable to another with Distinct


DataTable MainDataTable = new DataTable();
...Set values for MainDataTable
//Set First Argument as true if needs as distinct otherwise set false
DataTable ReceiveTable = MainDataTable.DefaultView.ToTable(true, new string[] { "columnName1", "columnName2" });