File 2


Friday, July 8, 2011

what is interface?
how we can use interface in .net?

what is partial class?
what is the difference between partial class and abstract class?

what is constructor?




what is difference between function and SP?
User-defined function
=====================

A user-defined function is a routine that encapsulates useful
logic for use in other queries. While views are limited to a
single SELECT statement, user-defined functions can have multiple SELECT statements and provide more powerful logic than is possible with views.

1>Procedure can return zero or n values whereas function can return one value which is mandatory.

2>Procedures can have input,output parameters for it whereas functions can have only input parameters.

3>Procedure allow select as well as DML statement in it whereas function allow only select statement in it.

4>Functions can be called from procedure whereas procedures cannot be called from function.

5>Exception can be handled by try-catch block in a procedure whereas try-catch block cannot be used in a function.

6>We can go for transaction management in procedure whereas we can't go in function.

7>Procedures can not be utilized in a select statement whereas function can be embedded in a select statement.





what is sclar and static function in sql server 2005?

why we set 'SET NOCOUNT ON and OFF'?
Ans : SET NOCOUNT ON added to prevent extra result sets from interfering with SELECT statements.

why we set SET ANSI_NULLS ON and OFF?

why we SET QUOTED_IDENTIFIER ON ?

what is the difference between SP and Trigger?

if we have 1000 rows in table and no primary key or anything, how we will get 99 th row from the table?

what is WCF and WPF?

what is silverlight?

how do you handle xml pharasing in .net code or sql server?



what is temp table and what is the difference between temp table and local table?
Ans :A local temporary table lives until the connection is valid or until the duration of a compound statement.

They are created using same syntax as CREATE TABLE except table name is preceded by ‘#’ sign. When table is preceded by single ‘#’ sign, it is defined as local temporary table and its scope is limited to session in which it is created.

Open one session in Query Analyzer or SSMS (Management Studio) and create a temporary table as shown below.

CREATE TABLE #TEMP
(
COL1 INT,
COL2 VARCHAR(30),
COL3 DATETIME DEFAULT GETDATE()
)
GO


A global temporary table is permanently present in the database. However, the rows of the table are present until the connection is existent. Once the connection is closed, the data in the global temporary table disappears. However, the table definition remains with the database for access when database is opened next time.

Syntax difference between global and local temporary table is of an extra ‘#’ sign. Global temporary tables are preceded with two ‘#’ (##) sign. Following is the definition. In contrast of local temporary tables, global temporary tables are visible across entire instance.

CREATE TABLE ##TEMP_GLOBAL
(
COL1 INT,
COL2 VARCHAR(30),
COL3 DATETIME DEFAULT GETDATE()
)
GO




How many types of cache are there in .net?
Ans :Caching is a feature that stores data in local memory, allowing incoming requests to be served from memory directly.

ASP.NET provides the following types of caching that can be used to build highly responsive Web applications:

1.Output caching : which caches the dynamic response generated by a request.
2.Fragment caching : which caches portions of a response generated by a request.
3.Data caching : which allows developers to programmatically retain arbitrary data across requests.


Type of exception handling in .Net ?
Ans: There are three ways to handle exceptions/errors in ASP.NET:

try-catch block. This is also called Structured Exception Handling (SEH).
Error Events.
Custom Error Page.

try-catch Block
Enclose code that accesses files, databases, and so forth inside a try-catch block because access to those resources might be denied due to various reasons causing an exception. The third part of this block is finally. It is executed irrespective of the fact that an exception has been raised. Hence, use the finally block to complete the housekeeping jobs.

Using Error Events
There are three different error events in ASP.NET that can be used in conjunction with SEH so that all exceptions are handled and the user is presented with a user-friendly error message.

Page_Error: Occurs when an error occurs within the Web page. This event is in the Web form.
Global_Error: Occurs when an error occurs within the application. This event is in the Gloabl.asax file.
Application_Error: Occurs when an error occurs within the application. This event is in the Gloabl.asax file.
Methods in the Server object are used to handle the exception in the error events.

GetLastError: Gets the last exception that occurred on the server.
ClearError: Use this method to handle the exception and stop the error to trigger the subsequent error event or display the error to the user.


Using Custom Error Pages
Use custom error page to handle HTTP exceptions such as page not found, unauthorized access, and so forth. You can specify custom error pages in two places:

customErrors section of the web.config file. This setting specifies the application-wide error page to display for unhandled HTTP errors. HTTP errors are identified by the HTTP status code. Include the tag in the customErrors to display a status code-specific error page. Does not work with .htm or .html files. Set the mode attribute to "On" to view the error page locally.
errorPage attribute of the @Page directive of the Web form to display the error page for the error generated on the particular Web form.



what is IIS Metabase..

IIS metabase is the repository of the configuration values that are set in the Internet Information Server (IIS). The IIS metabase in an XML file. It may be controlled through program or manually too.

In order to edit IIS metabase entries, the user needs to have administrative rights on the system. To do this, in run window, type "inetmgr". Browse to "Local Computer" and right click it. Click on "Properties". Select the "Enable Direct Metabase Edit" check box.

Many times, due to the existence of multiple versions of .NET framework, some settings in the IIS metabase may get affected and cause your program not to run. For such scenarios, you may take a backup of the IIS metabase XML file and recover it. To create a portable backup, open run window and type "inetmgr". Next browse to "Local Computer" and go to "All Tasks". Next, click on Backup/Restore Configuration. Next, click on "Create Backup". In the textbox box for Configuration Backup name, type a name for your backup file. Also select the encrypt backup option and type a password. To finish the process, click "OK".

No comments :