Clear cache in Code Behind

February 27, 2013

Using this Code you can clear the browser cache.

You can also use it on LogOut of your site.


Get Current Page Name Using Javascript

February 27, 2013

Using this script you can get the name of current page.

<script language=”javascript”>
function getPageName() {
var URL = window.location.pathname;

var PageName = URL.substring(URL.lastIndexOf(‘/’) + 1);
return PageName;


MS Sql Server stores all database details

February 27, 2013

MS SQL Server Stores Detail in System table

SELECT name AS ObjectName,
OBJECT_NAME(schema_id) SchemaName,
OBJECT_NAME(parent_object_id) ParentObjectName, name, *
FROM sys.objects
WHERE type = ‘p’
Object type:

AF = Aggregate function (CLR)
C = CHECK constraint
D = DEFAULT (constraint or stand-alone)
F = FOREIGN KEY constraint
PK = PRIMARY KEY constraint
P = SQL stored procedure
PC = Assembly (CLR) stored procedure
FN = SQL scalar function
FS = Assembly (CLR) scalar function
FT = Assembly (CLR) table-valued function
R = Rule (old-style, stand-alone)
RF = Replication-filter-procedure
S = System base table
SN = Synonym
SQ = Service queue
TA = Assembly (CLR) DML trigger
TR = SQL DML trigger
IF = SQL inline table-valued function
TF = SQL table-valued-function
U = Table (user-defined)
UQ = UNIQUE constraint
V = View
X = Extended stored procedure
IT = Internal table

Check Case Sensitive in Sql

February 14, 2013

Write Query like this

Select MastCode ,UserName ,UPassword from TblUserMaster where UserName=’admin’ COLLATE SQL_Latin1_General_CP1_CS_AS

Pass TableName as a Parameter

February 14, 2013

Declare @tbl as nvarchar(max)
set @tbl=’TblItemMaster’
SET @cmd = N’SELECT * FROM ‘ + @tbl +’ Where MastCode = 1′
EXEC sp_executesql @cmd

Javascript from Server Side

February 14, 2013

Page.ClientScript.RegisterStartupScript(this.GetType(), “keyForScript”, “alert(‘This is Server side alert box!’)”, true);

ScriptManager.RegisterClientScriptBlock(this,this.GetType(), “key”, “alert(‘This is Server side alert box!’)”, true); //for update panel,have to include “using System.Web.UI;”

Enjoy javascript from Server side