Wednesday, December 3, 2014

Convert HTML to Plain Text

 public string HTMLToText(string HTMLCode)
            // Remove new lines since they are not visible in HTML
            HTMLCode = HTMLCode.Replace("\n", " ");

            // Remove tab spaces
            HTMLCode = HTMLCode.Replace("\t", " ");

            // Remove multiple white spaces from HTML
            HTMLCode = Regex.Replace(HTMLCode, "\\s+", " ");

            // Remove HEAD tag
            HTMLCode = Regex.Replace(HTMLCode, "", "" , RegexOptions.IgnoreCase | RegexOptions.Singleline);

            // Remove any JavaScript
            HTMLCode = Regex.Replace(HTMLCode, "

Monday, March 3, 2014

Test Your Love

Test Your Love How much it is pass or acquire marks.

Tuesday, February 25, 2014

Kill All Process in database sql while restoring

If there is any problem that database currently in use and you are not able to restore database than you can run this query for block all processes currently running.

Use Master

Declare @dbname sysname

Set @dbname = 'CDM_HVMS'

Declare @spid int
Select @spid = min(spid) from master.dbo.sysprocesses
where dbid = db_id(@dbname)
While @spid Is Not Null
        Execute ('Kill ' + @spid)
        Select @spid = min(spid) from master.dbo.sysprocesses
        where dbid = db_id(@dbname) and spid > @spid
print 'done'

Monday, October 21, 2013

Check Existing record by join two tables using Linq

//Use this code to check existing record from two tables using Linq .

Chrome_VINEquipment existequipment = db.Chrome_VINEquipments.Where(x => x.VINPatternID == VinPatternID && db.WS_GenericEquipments.Any(c => c.StyleId == car.StyleId)).FirstOrDefault();

Monday, July 8, 2013

Find Item in DropDownlist

Find Item in dropdown if item find then selected or its ignored .with this code.....
ddlBody.SelectedIndex = ddlBody.Items.IndexOf(ddlBody.Items.FindByValue(Convert.ToString(lst[0].BodyId)));

Tuesday, June 25, 2013

Update row by row any field without cursor

WITH myTable2 AS
    SELECT vinid, ROW_NUMBER() OVER (ORDER BY vinid) AS sequence
    FROM VehicleDescription

UPDATE genericequipment
SET VinID = VehicleDescription.vinid
FROM VehicleDescription
JOIN genericequipment on VehicleDescription.VinPattern = genericequipment.vinPattern;