Tuesday, April 26, 2005

Find out all the IDENTITY Columns of all the Tables from the Database



Using COLUMNPROPERTY,OBJECTPROPERTY,you can get the primary key from INFORMATION_SCHEMA.COLUMNS table

COLUMNPROPERTY ( id , column , property )
Returns information about a column or procedure parameter.

OBJECTPROPERTY ( id , property )
Returns information about objects in the current database.


SELECT TABLE_NAME as TableName,
COLUMN_NAME as [Column],
DATA_TYPE as DataType

FROM INFORMATION_SCHEMA.COLUMNS

WHERE
COLUMNPROPERTY ( OBJECT_ID(TABLE_NAME), COLUMN_NAME, 'IsIdentity') = 1
AND OBJECTPROPERTY ( OBJECT_ID(TABLE_NAME), 'IsMSShipped') = 0

Monday, April 18, 2005

To Print A to Z Using SQL Query



This is Print A-Z
------------------------
DECLARE @LETTER CHAR(1),
@I INT
SET @I=65
WHILE(@I< = 90)
BEGIN
SET @LETTER = CHAR(@I)
SET @I=@I+1;
SELECT @LETTER
END

This is print a-z
---------------------------
DECLARE @LETTER CHAR(1),@I INT
SET @I=97
WHILE(@I< =122)
BEGIN
SET @LETTER = CHAR(@I)
SET @I=@I+1;
SELECT @LETTER
END

Sunday, April 17, 2005

Behind of JIT

The JIT compiler is responsible for performing a much more thorough verifica­tion process than the Class Loader perform.

The JIT verification process ensure s that only legal operations are performed against a cIass. It also ensures that the type being referenced is compatible with the type being accessed.

Security access permissions are also checked on various levels.

The JIT operates on the Concept that not all of an application's Code is always executed. Rather than waste CPU time and memory by converting an entire MSIL File to native code,the JITconverts only the code the application needs at any given time. This is one of the key strategies behind improving the performance and scalablity of applications written for the.NET Framework.

C# Method Call



using System;

namespace VirtualTest
{

public class a
{
public string a1()
{
return "base a1";
}

public string a2()
{
return "a2" ;
}

public string a3()
{
return "a3" ;
}

}

public class b : a
{


public string b1()
{
return "b1" ;
}

public string b2()
{
return "b2" ;
}

public string b3()
{
return "b3" ;
}


}
public class main
{
public static void Main()
{
a obja = new b();
string hi = obja.??????;
}


}


}


What are all the methods you can call for obja.

Ans : Base class method a1,a2,a3

Saturday, April 16, 2005

String Reverse without using reverse key word in C#

using System;
public class Entrance
{
public static void Main()
{
string str = "sankar";
Console.WriteLine(str.Length);
for(int i=str.Length-1;i>=0;i--)
{
Console.Write(str.Substring(i,1));
}
Console.ReadLine();
}
}

Comparison Datagrid,Datalist& Repeater



Both the DataGrid and DataList controls are derived from the WebControl class,

while the Repeater control is derived from the Control class.

The WebControl class contains a number of aesthetic properties, such as BackColor, ForeColor, CssClass, BorderStyle and so on. This means that with the DataGrid and DataList you can specify stylistic settings through the properties it inherits from the WebControl class. The Repeater, however, does not have any such stylistic properties. As we'll discuss in the "Digging Into the Repeater" section, any visual settings to the Repeater's output must be specified in the Repeater's templates.



There are five built-in DataGrid column types:
-------------------------------------------------
Bound Column
Button Column
Edit Column
HyperLink Column
Template Column


Template Supported By DataGrid
-----------------------------------
Item Template,
Header Template,
Footer Template
EditItem Template.

Template Supported By DataList
-----------------------------------
Item Template,
Header Template,
Footer Template
EditItem Template.
selectItem Template
separator Template

Tuesday, April 12, 2005

Shrink Database (MSSQL SERVER 2000)

You are maintaing the various Database in ur system while the space is also in ur consideration.If u wanna reduce the large space without deleting database, Run the query in ur SQL Query Analyzer


sp_helpdb 'databasename'

backup log DataBaseName with truncate_only

dbcc shrinkfile(databasename_log,10)


Now Check your Harddisk's Space,Really its reduce the space because of Shrinking operation.

Case Sensitive Search in MSSQL

If you wanna get the Column Value from the Table With CaseSensitive
--------------------------------------------------------------------
SELECT * FROM TABLENAME
WHERE CONVERT(VARBINARY(50),COLUMNNAME) = CONVERT(VARBINARY,'COLUMNVALUE')

SELECT * FROM Employee
WHERE CONVERT(VARBINARY(50),EmpName) = CONVERT(VARBINARY,'SaNkar')

This query will return exact match of SaNkar.

Tuesday, April 05, 2005

Q & A

What is the Diff b/w Un-Safe Code and Un-managed Code ??

By un-safe code, it means that the managed program can access the memory address using pointers.

There are two points to remember here;
* Un-safe code is different from un-managed as it is still managed by the CLR
* You still can not perform pointer arithmetic in un-safe code.
Un-managed code runs outside the Common Language Runtime (CLR) control while the unsafe code runs inside the CLR’s control.

autoevent wireup attribute of page in asp.net??

If the value of the AutoEventWireup attribute is set
to false, you must override the OnInit function, and
then you must add a new delegate for the Page_Load
event handler

session concept.

Session is used to keep track of the particular user.


what is the defference between Response.Redirect and
Server.Transfer ??


Server.Transfer is used to post a form to another
page. Response.Redirect is used to redirect the user
to another page or site.


Monday, April 04, 2005

Interview 1

how authentication is done by sqlserver


If user entered in ur webapplication,At very first time of login only he can access a one value of ur application (first time only that value is accessible).....

Ans : Application_onStart



You cannot use the virtual modifier with the following modifiers:
static,abstract,override


You are creating the 3 windows service 1,2,3 on one system.when you install using instalutil.exe on cmd mode,while 2 services installed successfully but 3 rd service throw the error exception,In this situation how many windows services installed on that system.....

None
1
2
3

Ans : Idk very sure.None is my answer coz if any exception occur in cmd mode while we installing windows service, Transaction Rolled back error msg wil be displayed.


How to debug the Windows Service????

In Web.config,which part u customized ur application error?????

How to Filter the rows in dataview???

DataView dataViewForRegion =dsReport.Tables[0].DefaultView;
dataViewForRegion.RowFilter = "RegionID='Chennai'";

another one

if Chennai is variable
dataViewForRegion.RowFilter = "RegionID='"+Chennai+"'";



If u are not using Codebdhind Technique in ur code,At that time wat r all the code shoul be there ???

Ans: Page_Load (Sender obj,EventArgs e)


what about DataSet1.Merge(DataSet2)

If exception occured in ur webservice's webmethod,What exception it wil throw???
Ans : System.Web.Services.protocol.SoapException


If u want to improve the efficiency of ur webapplication,What are all the Steps u have to take????

eg >>> set Autoeventwireup = false
set EnableSessionstate = false
set SmartNavigation = false

I give the connection Pooling size is 50.If 51 th request wil come what will happen???

Ans : throws the Exception (server application is unavailable)