Posts

shortcut key for \ Backslash

you can generate it by holding ALT + 092

convert Date by Exact Format

To convert Date time by Format string datestring="12/2/2012"; DateTime.ParseExact(datestring, "MM/dd/yyyy", CultureInfo.InvariantCulture);

in clause to match all items

select * from ItemsPackage where ItemId IN (3,5,2) This will be match as OR Expression to make it get ALL item Id you can make it : select PakageId from ItemsPackage where ItemId in (3,5,2) group by PakageId having count(PakageId) = 3 -- Count of In clause (3,5,2)

add days to date Javascript

To add days to javascript use : // days added var days=5; var ms = new Date().getTime() + (86400000 * days); var added = new Date(ms);

Check if variable is 'undefined' or 'null'

to check if javascript variable is undefined or nul use : if(typeof variable_here === 'undefined'){ // your code here. }; OR : if(! variable_here){ // your code here. };

Retrieve Last Inserted Identity

To returns the last IDENTITY value produced on a connection get last Identity your Session added by your Connection if they any trigger add to any other tables it will return it SELECT @@IDENTITY To returns the last IDENTITY value produced on a connection and by a statement in the same scope SELECT SCOPE_IDENTITY() To returns the last IDENTITY value produced in a table it returns the identity value generated for a specific table in any session and any scope SELECT IDENT_CURRENT('tablename') To avoid the potential problems associated with adding a trigger later on, always use SCOPE_IDENTITY() to return the identity of the recently added row in your T SQL Statement or Stored Procedure.

Get URL Parameter "Query strings"

to get paraneter from url string Url = "http://localhost:6109/CANSHOP/GenerateCoupons.aspx?CouponId=1&MemberId=4"; Uri tempUri = new Uri(Url); string sQuery = tempUri.Query; var query = HttpUtility.ParseQueryString(sQuery); string cId = query["CouponId"]; string mId = query["MemberId"];