Wednesday, October 21, 2009

Partial Page Print in HTML

Write this function in javascript tag and call in your page. Here "printingstuff" is a div tag.

function printDiv()
{
var printer = window.open('','','width=640,height=700');
printer.document.open("text/html");
printer.document.write(document.getElementById('printingstuff').innerHTML);
printer.document.close();
printer.window.close();
printer.print();
alert("Printing the \"printingstuff\" div...");
}

Wednesday, October 14, 2009

Speed up the Queries, Reindex the tables

Whenever we get timeout error, we need To Speed up the queries by running the following Queries in Database
1) First Way is
ALTER INDEX ALL ON Tablename REBUILD WITH (FILLFACTOR = 80)
UPDATE STATISTICS Tablename WITH FULLSCAN, NORECOMPUTE
EXEC SP_UPDATESTATS

2) Second Way is
DBCC DBREINDEX (Tablename, '', 90)