Friday, 17 August 2012

Code Execution Time using Stop watch


            using System.Diagnostics;
            using System.Threading;        
            ............
    
            Stopwatch stopWatch = new Stopwatch();
            stopWatch.Start();
            //instead of this there is line of code that you are going to execute
            Thread.Sleep(1000);
            stopWatch.Stop();
            // Get the elapsed time as a TimeSpan value.
            TimeSpan ts = stopWatch.Elapsed;
            string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
            ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10);
            Console.WriteLine(elapsedTime);
            Console.ReadLine();

Monday, 6 August 2012

Sunday, 5 August 2012

Get the value from input control of html


<input name="txt" type="text" value="this is for test" />

string text =Request["txt"];

how to get last record value in sql server without using MAX/TOP clause?


1)SELECT * FROM  tablename WHERE  primarykeyid= IDENT_CURRENT('tablename')

Eg:
SELECT * FROM  tbl_emp WHERE  empid= IDENT_CURRENT('tbl_emp ')

2)
set rowcount 1 
select * from  tbl_emp order by empid desc

SET ROWCOUNT { number | @number_var } 
Causes SQL Server to stop processing the query after the specified number of 
rows are returned.

Enable compatibility mode for IE in C#


<html>
<head>
<meta http-equiv="X-UA-Compatible"content="IE=9;IE=8; IE=7; IE=EDGE" />
<title>My webpage</title>
</head>
<body>
<p>Content goes here.</p>
</body>
</html>

Now it'll try IE9 mode first, IE8, then IE7. You can even set IE=EDGE so it'll use the highest mode possible.

The X-UA-Compatible header is not case sensitive; however, it must appear in the header of the webpage (the HEAD section) before all other elements except for the title element and other meta elements.


Manually
[image[2].png]