Friday, August 22, 2008

KeaneIndia Interview Question Answer

KeaneIndia
How do you set language in web.cofig ?

To set the UI culture and culture for all pages, add a globalization
section to the Web.config file, and then set the uiculture and
culture attributes, as shown in the following example:

To set the UI culture and culture for an individual page,set the
Culture and UICulture attributes of the @ Page directive, as shown in
the following example:

How many web.config a application can have ?
Tell About Web.config ?

What is application variable and when it is initialized ?
it is the process of client side state managment
we can specify like
application["str"]="Value for ref";
like the above in global.asax
this is for global purpose
we can use this value in any where of our application
Tell About Global.asax ?
Global.asax is a file that resides in the root directory of your application. It is inaccessible over the web but is used by the ASP.NET application if it is there. It is a collection of event handlers that you can use to change and set settings in your site. The events can come from one of two places - The HTTPApplication object and any HTTPModule object that is specified in web.confg or machine.config
What is Response.Flush method ?
It sends all buffered data to client immediately
Difference between server.Execute and response.redirect ?
Server.execute combines the results of 2 pages into 1 page.It is normally used when the second page does not have controls which trigger postback events.
Response.redirect is used to redirect to another page from the first page
What is the need of client side and server side validation ?
client side validation are used to reduce the burden on server because if you write server side validation each and every request is send to server and server gives the response each and every time so burden on server. to avoid this problem by using client side validations.we can write some of validations at server side regarding security.
Write steps of retrieving data using ado.net ?
we can use two ways to retrieve the data from database
1 -> data reader
2 -> data adapter
when you use datareader
create connection object and open the connection
SqlCommand cmd = new SqlCommand(sql,con);
cmd.CommandType = CommandType.Text;
SqlDataReader sread = cmd.ExecuteReader();
while(sread.Read())
{
String data1 = sread.GetString(0);
int data2 = sread.GetValue(1);
String data3 = sread.GetString(2);
}
when u use the dataadapter
create the connection and open
SqlDataAdapter sda = new SqlDataAdapter(sql,con);
DataSet ds = new DataSet();
sda.Fill(ds,"customer");
then use can get the data in row wise or directly assign the data to the controls through datasource.
Call a stored procedure from ado.net and pass parameter to it ?
create a connection object
create a command object like so
SqlCommand comm=new SqlCommand("storedprocname",conn)
comm.commandtype=cmmandtype.storedprocedure
and then add parameters like:
comm.parameters.addwithvale("@userid",textbox1.text)
comm.parameters.addwithvalue(@username",textbox2.text)
When we are running the Application, if any errors occur in the Stored Procedure then how will the server identify the errors?
Using SqlException handlers.

No comments:

.

.