Posts

How to Zip the folder using C#

public static void AddFolderToZip(string sourcePath,string zipFullName)         {             DirectoryInfo CurrentFolder = new DirectoryInfo(sourcePath);             DirectoryInfo RootFolder = CurrentFolder.Parent;             DirectoryInfo[] SubFolders = RootFolder.GetDirectories(CurrentFolder.Name);                                     if (SubFolders.LongLength > 0)             {                 //Add all subfolders to the zip if any         ...

How to Convert Word Document to PDF using C#

  Document wordDocument = null;             string Sourcepath = ConfigurationSettings.AppSettings["SourcePath"];             string DestinationPath = ConfigurationSettings.AppSettings["DestinationPath"];             DirectoryInfo dirInfo = new DirectoryInfo(Sourcepath);             FileInfo[] wordFiles = dirInfo.GetFiles("*.doc");             foreach (FileInfo wordFile in wordFiles)             {                 object paramSourceDocPath = (Object)wordFile.FullName;                 //(Object)wordFile.Na...

On Cascading deletes in SQL Server

CREATE TABLE USERS (     USR_ID int     ,CONSTRAINT [PK_Temp_Users1] PRIMARY KEY CLUSTERED ([USR_ID]) ) CREATE TABLE USER_PHONE (     USR_ID int     ,CONSTRAINT [PK_Temp_Users2] PRIMARY KEY CLUSTERED ([USR_ID]) ) ALTER TABLE [dbo].USER_PHONE  WITH CHECK ADD CONSTRAINT [FK_Temp_UsersPhone_Users] FOREIGN KEY([USR_ID]) REFERENCES [dbo].[Users] ([USR_ID]) ON DELETE CASCADE GO INSERT INTO USERS     SELECT 1 UNION SELECT 2 UNION SELECT 3 INSERT INTO USER_PHONE     SELECT 1 UNION SELECT 2 UNION SELECT 3 SELECT * FROM USERS SELECT * FROM USER_PHONE DELETE USERS WHERE USR_ID=2 SELECT * FROM USER_PHONE DROP TABLE USER_PHONE DROP TABLE USERS

Different types of Time Picker Control examples

http://www.jquery.wisdomplug.com/jquery-plugins/time-picker-jquery-plugin/ http://fgelinas.com/code/timepicker/ http://www.ama3.com/anytime/ http://www.eworldui.net/CustomControls/TimePickerDemo.aspx http://www.asp.net/community/control-gallery/Item.aspx?i=3221 http://www.codeproject.com/KB/selection/cstimepicker.aspx http://jqueryui.com/demos/datepicker/ http://www.codeproject.com/KB/selection/cstimepicker.aspx http://timepicker.codeplex.com/ http://peterblum.com/DES/DemoTimeTextBox.aspx http://jobijoy.blogspot.com/2007/10/time-picker-user-control.html http://jquerybyexample.blogspot.com/2011/12/jquery-timepicker-plugin-demo.html

How to call button event in javascript for cross browsers

function SubmitClick(bt) {        if (navigator.appName.indexOf("Microsoft Internet Explorer") > -1) {         bt.click();         return false;     }     else {         if (bt && typeof (bt.click) == 'undefined') {             bt.click = addClickFunction(bt);             return false;         }         else {             bt.click();             return false;         }         return false;     } } function addClickFunction(bt) { ...

How to kill all sql processes in database

Declare @spid varchar(max) set @spid=Null SELECT  @spid = COALESCE( @spid +'; Kill ' +  ' ','') + CAST(spid AS VARCHAR(10))   FROM master..sysprocesses  WHERE dbid = DB_ID('db name')    AND spid != @@SPID if @spid is not null set @spid='Kill '+ @spid print @spid exec(@spid) select *  FROM master..sysprocesses  WHERE dbid = DB_ID('db name')  AND spid != @@SPID

How to get nth Highest salary of Employee in Department wise

select * from ( select EmployeeName,  DeptID,  Sal,  Rank() over (Partition BY EmployeeName  order by Sal DESC, DeptID DESC) as Rank from Employee ) tmp where Rank = @n