Wednesday, 9 February 2011

How to write Stored Procedure in SQL Server 2005 ?


Hi Friends,
This is a very small thing for a developer but as beginner some time we hang up into write a stored procedure in sql server 2005 or sql server 2008. So I am giving a example of how to write stored procedure for insert data into database:

Set ANSI_NULLS ON
Set QUOTED_IDENTIFIER ON
Create Procedure [dbo].[sp_RegInsert]
                @RegID int,
                @FullName nvarchar(50),
                @Address nvarchar(MAX),
                @ImageUrl nvarchar(MAX)
AS
Begin
                Select @RegID = IsNull(max(RegID),0) + 1 from tblReg
                Insert Into tblReg (
                RegID,
                FullName,
                Address,
                ImageUrl)
Values (
                @RegID,
                @FullName,
                @Address,
                @ImageUrl)
END

Thanks to All...


Saturday, 5 February 2011

Current Affairs January 2011

1.Consider the following facts about a country in Africa:
1. This country was once known as Economic Power House of West Africa
2. It is world's largest producer of cocoa and third largest producer of coffee.
3. In recent times, there is a political turmoil in this country following the presidential election leading to widespread coverage in media all over world.
Identify this country from the given options:

(A)Liberia
(B)Ghana
(C)Mali
(D)Côte d'Ivoire

Ans: D


2.Hashim Thaci, who is facing charges of Human Trafficking is prime minister of which among the following countries / territories ?
(A)Serbia
(B)Kosovo
(C)Bulgaria
(D)Bosnia and Herzegovina

Ans: B

3.Indian Navy and which among the following Navies have regularly conducted joint exercises named 'INDRA' since 2003?
(A)Russian
(B)UK
(C)US
(D)Australia

Ans: A

4.In which state are located the Integrated Kashang Hydroelectric Project & Sainj Hydroelectric Project which are being supported by Asian Development Bank ?
(A)Jammu & Kashmir
(B)Himachal Pradesh
(C)Uttarakhand
(D)Punjab

Ans: B

5.Consider the following:
1. Near Infrared
2. Mid Infrared
3. Far Infrared
Which among the following is the correct order of increasing wavelength of the above?
(A)1 2 3
(B)3 2 1
(C)2 1 3
(D)3 1 2

Ans: A

6.Where are the headquarters of National Cadet Corps ?
(A)Pune
(B)New Delhi
(C)Chandigarh
(D)Bhopal

Ans: B

7.The Indo-UK Task Force has been created for which among the following ?
(A)Military Affairs
(B)Corporate Affairs
(C)Social Affairs
(D)Bilateral Issues

Ans: B

8.In the 11th plan the share of which among the following kinds of electricity has decreased from 2007-2010 period?
(A)Nuclear Power Capacity
(B)Thermal Power Capacity
(C)Hydro Power Capacity
(D)Solar Power Capacity

Ans: C

9.Consider the following statements:
1. Government of India is planning to invest one trillion US dollar on infrastructure in 12th five Year Plan
2. Half of this investment is envisaged to be financed through private sources
Which among the above statements is / are correct?
(A)Only 1
(B)Only 2
(C)Both 1 & 2
(D)Neither 1 nor 2

Ans: C

10.Container Corporation of India Limited (CONCOR) comes in which among the following categories?
(A)Mini Ratna
(B)Navratna
(C)Maharatna
(D)None of them

Ans: A

11.The Union Cabinet has recently approved declaration of which among the following dates to be celebrated every year as the "National Voters' Day"?
(A)24 January
(B)25 January
(C)27 January
(D)28 January

Ans: B

12.Consider the following statements related to India's First Defense Procurement Policy released recently:
1. The Government puts emphasis on Indigenous manufacturers and vendors
2. The Foreign Vendors are required to source at least 30% of spare parts from the Domestic vendors
Which among the above statements is / are correct?
(A)Only 1 is correct
(B)Only 2 is correct
(C)Both 1 & 2 are correct
(D)Neither 1 nor 2 is correct

Ans: A

13.Consider the following statements:
1. Coastal Regulation Zone 2011 regulates the Islands of Andaman and Nicobar Islands
2. Coastal Regulation Zone 2011 has been enacted by an act of parliament
3. Coastal Regulation Zone 2011 replaces the 1991 notification
Which among the above statements is / are correct?
(A)Only 1 & 3
(B)All 1, 2 & 3
(C)Only 2 & 3
(D)Only 3

Ans: D

14.Recently a Central team was sent to Ahamadabad and Pune to investigate the outbreak of "Crimean–Congo hemorrhagic fever(CCHF). This disease caused by which among the following?
(A)Virus
(B) Bacteria
(C)Protozoa
(D)Insects

Ans: A

15.Who among the following appoints a Judge in the High Court of Indian state?
(A)President with advice of Chief Justice of India
(B)President with Advice of Prime Minister
(C)Law Ministry
(D)President with Advice of a collegium of Judges

Ans: D

Thursday, 3 February 2011

Live Interview with FUTURESOFT P. LTD DELHI for ASP.Net


Q.1 What is the difference between Server.Transfer and Response.Redirect?
Ans: Server.Transfer() : client is shown as it is on the requesting page only, but the all the content is of the requested page. Data can be persist across the pages using Context.Item collection, which is one of the best way to transfer data from one page to another keeping the page state alive.

Response.Dedirect() : client know the physical location (page name and query string as well). Context.Items loses the persistence when navigate to destination page. In earlier versions of IIS, if we wanted to send a user to a new Web page, the only option we had was Response.Redirect. While this method does accomplish our goal, it has several important drawbacks. The biggest problem is that this method causes each page to be treated as a separate transaction. Besides making it difficult to maintain your transactional integrity, Response.Redirect introduces some additional headaches. First, it prevents good encapsulation of code. Second, you lose access to all of the properties in the Request object. Sure, there are workarounds, but they’re difficult. Finally, Response.Redirect necessitates a round trip to the client, which, on high-volume sites, causes scalability problems.
As you might suspect, Server.Transfer fixes all of these problems. It does this by performing the transfer on the server without requiring a roundtrip to the client. Examples:

Server.Transfer
Server.Transfer("Webform2.aspx")

Response.Redirect
Response.redirect("Webform2.aspx")

Q.2 What are row level and statement level triggers?
Ans: The FOR EACH ROW option determines whether the trigger is a row trigger or a statement trigger. If you specify FOR EACH ROW, then the trigger fires once for each row of the table that is affected by the triggering statement. The absence of the FOR EACH ROW option indicates that the trigger fires only once for each applicable statement, but not separately for each row affected by the statement.

Q.3 page events in asp.net ?
Ans: When we talk about the ASP.Net 1.0/1.1 we find total of the nine events that are:
ü      AbortTransaction.
ü      CommitTransaction
ü      DataBinding
ü      Dispose
ü      Error
ü      Init
ü      Load
ü      PreRender
ü      Unload

Q.4 What's in an HTTP request?
Ans: Whenever your web browser fetches a file (a page, a picture, etc) from a web server, it does so using HTTP - that's "Hypertext Transfer Protocol". HTTP is a request/response protocol, which means your computer sends a request for some file (e.g. "Get me the file 'home.html'"), and the web server sends back a response ("Here's the file", followed by the file itself).

That request which your computer sends to the web server contains all sorts of (potentially) interesting information. We'll now examine the HTTP request your computer just sent to this web server, see what it contains, and find out what it tells me about you.

Q.5 What is NVL Function ?
Ans: NVL evaluates expression1. If expression1 is not NULL, then NVL returns the value of expression1. If expression1 is NULL, NVL returns the value of expression2. The expressions expression1 and expression2 can be of any data type, as long as they can be cast to a common compatible data type.

Suppose that the addr column of the employees table has NULL values in some rows, and the user wants to be able to print the label Address unknown for these rows. The user enters the following SELECT statement to display the label Address unknown when the addr column has a NULL value:

SELECT fname, NVL (addr, 'Address unknown') AS address
FROM employees

Q.6 ASP.NET Authentication ?
Ans: Authentication is the process of obtaining identification credentials such as name and password from a user and validating those credentials against some authority. If the credentials are valid, the entity that submitted the credentials is considered an authenticated identity. Once an identity has been authenticated, the authorization process determines whether that identity has access to a given resource.

ASP.NET implements authentication through authentication providers, the code modules that contain the code necessary to authenticate the requestor's credentials. The topics in this section describe the authentication providers built into ASP.NET.

Ø      Windows Authentication
Ø      Forms Authentication
Ø      Passport Authentication