Skip to main content

Posts

Showing posts from 2016

Get Web Browser Name In C#

publicstring GetWebBrowserName()      {  string WebBrowserName = string.Empty;  try        {              WebBrowserName = HttpContext.Current.Request.Browser.Browser;          }  catch (Exception ex)          {  thrownew Exception(ex.Message);          }  return WebBrowserName;      }

DOS Command (CMS) Create Folder Current Datetime and Move Files Shared Folder

@echo off    set hh=%time:~-11,2%    set /a hh=%hh%+100    set hh=%hh:~1%    set dateseed=%date:~10,4%%date:~4,2%%date:~7,2%_%hh%    %time:~3,2%%time:~6,2%    if not exist "\\140.175.165.10\Sharing\Databasebackup\    %dateseed%" mkdir "\\140.175.165.10\Sharing    \Databasebackup\%dateseed%"    copy D:\HELLO "\\140.175.165.10\Sharing\Databasebackup\

SQL Function Get Total Time in HH:MM:SS

CREATEFUNCTION [dbo].TotalTime  (                        @StartTime DATETIME,                        @EndTime DATETIME  )                      RETURNSVarchar(10)                      ASbeginDECLARE @D VARCHAR(400)='31784'Declare @outTime Varchar(10);      SELECT @D = DATEDIFF(SECOND,@StartTime,@EndTime)

How to remove empty lines in text In Visual

Visual Studio has ability to delete empty lines in replace operation using regular expressions. Click Ctrl-H (quick replace) Tick "Use Regular Expressions" In Find specify ^$\n In Replace box delete everything. Click "Replace All" All empty lines will be deleted. Regular expression for empty line consist of Beginning of line ^ End of line $ Line break \n

SQL Group With Group Total

SELECTisnull(WO_status,0) as WO_status,          (casewhen MwO.WO_status=1 then'Open'when MwO.WO_status=2 then'Close'when MWO.WO_status=3 Then'Short Close'when MwO.WO_status=4 then'Cancel'else'Total'end) as statusR,          count(*) as countValue                            FROM   M_WorkOrder MwO

Copy All tables with Data in Another Database

CREATEPROCEDURE [dbo].[uspCreateCopyTables]-- GOALTEST,GOAL   -- parameters for the stored procedure here      @toDatabase VARCHAR(100)        ,@fromDatabase VARCHAR(100)    ASBEGIN-- SET NOCOUNT ON added to prevent extra result sets from  SET NOCOUNT ON;    DECLARE @fullTableList VARCHAR(8000);    DECLARE @idx