Thursday, June 25, 2009

Asp.Net FAQ

Connection String:
Contain information that lets you connection to sql servar database.The connection string includesinformation such as the name of the server ,the name of the datasbase,and login information.

Open:Opens a connection to a database.

Close:Closes a connection to a database.

Connection:The SqlConnection object that's used by the command to connect to the database.
CommandText:The text of the SQL Command or the name of a stored Procedure or database table.

ExecuteReader:Execute a query and returns the result as a SqlDataReader object.

ExecuteNonQuery:Execute the command and returns an representing the number of rows affected.

ExecuteScalar:Execute a query and returns teh first column of the first row returned by the query.

What is the difference between “Dataset” and “Data Reader” ?Twist: - Why is Dataset slower than Data Reader is?Fourth point is the answer to the twist.

Following are the major differences between “Dataset” and “Data Reader”:-• “Dataset” is a disconnected architecture, while “Data Reader” has live connection while reading data. If we want to cache data and pass to a different tier “Dataset” forms the best choice and it has decent XML support.
• When application needs to access data from more than one table “Dataset” forms the best choice.
• If we need to move back while reading records, “data reader” does not support this functionality.
• However, one of the biggest drawbacks of Dataset is speed. As “Dataset” carry considerable overhead because of relations, multiple table’s etc speed is slower than “Data Reader”. Always try to use “Data Reader” wherever possible, as it is meant especially for speed performance.

What is difference between Dataset.Clone and Dataset. Copy?Clone: - It only copies structure, does not copy data.Copy: - Copies both structure and data.

Can you explain the difference between an ADO.NET Dataset and an ADO Record set?There two main basic differences between record set and dataset:-• With dataset you an retrieve data from two databases like oracle and sql server and merge them in one dataset , with record set this is not possible• All representation of Dataset is using XML while record set uses COM.• Record set cannot be transmitted on HTTP while Dataset can be.

What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other? Server.Transfer is used to post a form to another page. Response.Redirect is used to redirect the user to another page or site.

Whats an assembly?Assemblies are the building blocks of the .NET framework.

Describe the difference between inline and code behindInline code written along side the html in a page. Code-behind is code written in a separate file and referenced by the .aspx page.

Explain what a diffgram is, and a good use for one?The DiffGram is one of the two XML formats that you can use to render DataSet object contents to XML. For reading database data to an XML file to be sent to a Web Service.

Which method do you invoke on the DataAdapter control to load your generated dataset with data?.Fill() method

Can you edit data in the Repeater control?No, it just reads the information from its data source.

Which template must you provide, in order to display data in a Repeater control?ItemTemplate

How can you provide an alternating color scheme in a Repeater control?AlternatingItem Template.

What property must you set, and what method must you call in your code, in order to bind the data from some data source to the Repeater control?You must set the DataSource property and call the DataBind method.

What base class do all Web Forms inherit from?The page Class

Name two properties common in every validation control? Control to Validate property and Text Property

What tags do you need to add within the asp:datagrid tags to bind columns manually?Set Autogenerate colmns property to false on datagrid tag.

What is the transport protocol you use to call a Web service? SOAP is preferred Protocal.
SQL Connection:

String strConn=ConfigurationSettings.AppSettings["ConnectionString"];
ORSqlConnection ConnectionString = new SqlConnection("DataSource=ADDONSERVER\\SQLSERVER2005;Database=ramakrishna_DB;UID=sa1;pwd=syner123;pooling=false");con.Open();

What is DataAdapter?It is bridge between connection and Dataset,Dataadapter passing the query to fill the Dataset.

EG: Dim sqlStr as string Dim DA as SqlDataAdapter Dim DS As New DataSet Sqlstr=”SELECT * FROM emp” DA=New SqlDataAdapter(sqlstr, “Connection name”) DA.Fill(DS)

What does connection consists?Data connection consists Datasourse,Database,Username,Password.

What is default view of Datagrd?Like a table with columns and rows.

ADO and ADO.Net Difference?ado doesnot support database connectivity with purely dissconnected architecture and xml intigrationwhere ado.net supports database connectivity with purely dissconected architecture and xml intiration

Dataset and Datatable Difference?A dataset can hold the data of multiple tables, whereas data table can have only one table's data.

What is use of Command objects?In order to execute Sql commands and stored procedures we Need command objects

ExecuteNonQuery: Executes Insert, Update, and Delete statements (DML statements) and returns the number of rows affected.

Execute Reader: Executes the SQL query (Select statement) and returns a Reader object which can perform a forward only traversal across the set of records being fetched.

What is mean by .Net Framework? .net framework is a collection of services and classes.The .net framework has two main components.1. Common language run time and2. Framework class library1. Common language runtime:-Runtime agent the manages code at execution time, providing Core services such as memory management
Statemanagement:State management maintained the client side and server side user information. Two types of state management:Server side state management and Client side state management.Serverside: Session, Application, Caching, Profile.Clientside: Query string, Hidden field, Cookies, Viewstate.

What is deployment? How do you deploy .Net and Java applications It is a procedure to deploy a web application on the server.You can deploy .Net application by simply Xcopy and create virtual directory for the application on server.

What is meant by connection pooling and event pumbling in ado.netConnection Pooling:-Connection pooling reduces the number of times that new connections need to be opened. The pooler maintains ownership of the physical connection. It manages connections by keeping alive a set of active connections for each given connection configuration. Whenever a user calls Open on a connection, the pooler looks to see if there is an available connection in the pool. If a pooled connection is available, it returns it to the caller instead of opening a new connection. When the application calls Close on the connection, the pooler returns it to the pooled set of active connections instead of actually closing it. Once the connection is returned to the pool, it is ready to be reused on the next Open call.

How to sort the data in Datatablepass the datatable in dataview object and call the sort method on dataviewdataview dv=new dataview(dt)dv.sort

what is clustered index?why is it created?clustered index is a type oof index this is a physicalcomponent used to to resorted the data in a table. U can useonly one clustered index for a Table.

What are the Different layers in ADO.Net?1.Presentation Layer2.Business Logic layer3.Data Access Layer

http://downloads.phpnuke.org/
http://download.cnet.com/windows/

How did you design your data access layer?The Data Access Layer, which is coming from 3-tier Architecture model.All data accessing code will maintain single entity(Data Access Layer),which is Execute NonQuery,Execute Scalar,Execute Reader and Dataset.

What is difference in an Abstract Class and an Interface.An Abstract class has abstract methods. An Abtsract class can not be instanitiated directly. All the abtract methods are implemented in the derived class. There is no multiple inheritance here.
Interface class also has abstract methods and all of them are public. You can have multiple inheritance with Interfaces.

What are the Advantages of ADO.Net? Ado.net uses dataset for accessing the data , since the dataset is created in client side there is no need of connection at the time of working on dataset ,to the server(where the database is present), so this makes the data accessing faster mainly in the net environment.

list all the classes those are used for database connections between sql server and asp.net.
1.SqlClientPermission - Enables the .NET Framework Data Provider for SQL Server to help ensure that a user has a security level adequate to access a data source.
2.SqlClientPermissionAttribute - Associates a security action with a custom security attribute.
3. SqlCommand - Represents a Transact-SQL statement or stored procedure to execute against a SQL Server database. This class cannot be inherited.
4.SqlCommandBuilder - Automatically generates single-table commands used to reconcile changes made to a DataSet with the associated SQL Server database. This class cannot be inherited.
5. SqlConnection - Represents an open connection to a SQL Server database. This class cannot be inherited.
6.SqlDataAdapter - Represents a set of data commands and a database connection that are used to fill the DataSet and update a SQL Server database. This class cannot be inherited.
7.SqlDataReader - Provides a means of reading a forward-only stream of rows from a SQL Server database. This class cannot be inherited.
8.SqlError - Collects information relevant to a warning or error returned by SQL Server. This class cannot be inherited.
9.SqlErrorCollection - Collects all errors generated by the .NET Framework Data Provider for SQL Server. This class cannot be inherited.
10.SqlException - The exception that is thrown when SQL Server returns a warning or error. This class cannot be inherited.
11.SqlInfoMessageEventArgs - Provides data for the InfoMessage event. This class cannot be inherited.
12.SqlParameter - Represents a parameter to a SqlCommand, and optionally, its mapping to DataSet columns. This class cannot be inherited.
13.SqlParameterCollection - Represents a collection of parameters relevant to a SqlCommand as well as their respective mappings to columns in a DataSet. This class cannot be inherited.
14.SqlRowUpdatedEventArgs - Provides data for the RowUpdated event. This class cannot be inherited.
15.SqlRowUpdatingEventArgs- Provides data for the RowUpdating event. This class cannot be inherited.
16. SqlTransaction - Represents a Transact-SQL transaction to be made in a SQL Server database. This class cannot be inherited.

What is a "Virtual Directory"? Virtual directories are aliases for directory paths on the server. It allows moving files on the disk between different folders, drives or even servers without changing the structure of web pages. It avoids typing an extremely long URL each time to access an ASP page.

What is the difference between client-side script and server-side script? Scripts executed only by the browser without contacting the server is called client-side script. It is browser dependent. The scripting code is visible to the user and hence not secure. Scripts executed by the web server and processed by the server is called server-side script.

What is the maximum size of an array?Up to 60 dimensions.

What is a variable? Variable is a memory location through which the actual values are stored/retrieved. Its value can be changed.

What is the difference between syncronus and asyncronus?syncronus means you are waiting for the responce to come back, while in the asyncronus you start with the next staement andwhenever the results come back a call back function is called.

What is the difference between typed and untyped dataset?typed data set contains the inforation of the db/table structure

We can add a crystal report in aspx page using two techniques, what are these?1> embaeded in assembly2> outside the assembly

What is AJAX?Ajax is asynchronus javascript and xml, its a way of making an asynchronus calls to the server application.

Is AJAX a language?ajax is a concept not a langauge.

No comments:

Post a Comment