Sunday, 26 October 2014

asp.net interview questions Part-2

•    System.Data.OleDb – classes that make up the .NET Framework Data Provider for OLE DB-compatible data sources. These classes allow you to connect to an OLE DB data source, execute commands against the source, and read the results.
•    System.Data.SqlClient – classes that make up the .NET Framework Data Provider for SQL Server, which allows you to connect to SQL Server 7.0, execute commands, and read results. The System.Data.SqlClient namespace is similar to the System.Data.OleDb namespace, but is optimized for access to SQL Server 7.0 and later.
•    System.Data.Odbc - classes that make up the .NET Framework Data Provider for ODBC. These classes allow you to access ODBC data source in the managed space.
•    System.Data.OracleClient - classes that make up the .NET Framework Data Provider for Oracle. These classes allow you to access an Oracle data source in the managed space.
SQLClient .NET classes are highly optimized for the .net / sqlserver combination and achieve optimal results. The SqlClient data provider is fast. It’s faster than the Oracle provider, and faster than accessing database via the OleDb layer. It’s faster because it accesses the native library (which automatically gives you better performance), and it was written with lots of help from the SQL Server team.
In a DataSet that contains multiple DataTable objects, you can use DataRelation objects to relate one table to another, to navigate through the tables, and to return child or parent rows from a related table.  Adding a DataRelation to a DataSet adds, by default, a UniqueConstraint to the parent table and a ForeignKeyConstraint to the child table.
The following code example creates a DataRelation using two DataTable objects in a DataSet. Each DataTable contains a column named CustID, which serves as a link between the two DataTable objects. The example adds a single DataRelation to the Relations collection of the DataSet. The first argument in the example specifies the name of the DataRelation being created. The second argument sets the parent DataColumn and the third argument sets the child DataColumn.
custDS.Relations.Add(”CustOrders”,
custDS.Tables[”Customers”].Columns[”CustID”],
custDS.Tables[”Orders”].Columns[”CustID”]);
OR
private void CreateRelation()
{
// Get the DataColumn objects from two DataTable objects in a DataSet.
DataColumn parentCol;
DataColumn childCol;
// Code to get the DataSet not shown here.
parentCol = DataSet1.Tables[”Customers”].Columns[”CustID”];
childCol = DataSet1.Tables[”Orders”].Columns[”CustID”];
// Create DataRelation.
DataRelation relCustOrder;
relCustOrder = new DataRelation(”CustomersOrders”, parentCol, childCol);
// Add the relation to the DataSet.
DataSet1.Relations.Add(relCustOrder);
}
SqlConnection nwindConn = new SqlConnection(”Data Source=localhost; Integrated Security=SSPI;” +
“Initial Catalog=northwind”);
nwindConn.Open();
o    ADO.NET Does Not Depend On Continuously Live Connections
o    Database Interactions Are Performed Using Data Commands
o    Data Can Be Cached in Datasets
o    Datasets Are Independent of Data Sources
o    Data Is Persisted as XML
o    Schemas Define Data Structures
ASP.Net is an “environment”, and VB.Net is a programming language. You can write ASP.Net pages (called “Web Forms” by Microsoft) using VB.Net (or C#, or J# or Managed C++ or any one of a number of .Net compatible languages).
Confusingly, there is an IDE that Microsoft markets called VB.Net, which allows you to write and compile programs (WinForms, WebForms, class libraries etc) written in the language VB.Net
ASP.Net is simple a library that makes it easy for you to create web applications that run against the .NET runtime (similar to the java runtime).
VB.Net is a language that compiles against the common language runtime, like C#. Any .NET compliant language can use the asp.net libraries to create web applications.
Note : Actually there is not an IDE called VB.Net.  Microsoft’s IDE is called Visual Studio.Net which can be used to manage VB.Net, C#, Eiffle, Fortran, and other languages.
Custom Controls can be created in either of the following 3 methods.
1. Creating as a composite control : This method uses and combines the existing controls to give a custom functionality which can be used across different projects by adding to the control library. This can provide for event bubbling from child controls to the Parent container, custom event handling and properties. The CreateChildControls function of the Control class should be overridden for creating this custom control. This can also support design time rendering of the control.
2. Deriving from an existing control : This method of creating a custom control derives from an existing ASP .Net control and customizing the properties that we need. This also can support custom event handling, properties etc.,

3. Creating a control from Scratch : This method is the one which needs maximum programming. This method needs even the HTML code for the custom controls to be written by the programmer. This may also need one to implement the IPostBackDataHandler and IPostBackEventHandler interfaces. A detailed explanation with example for this is available at Rendering Custom Controls Sample in MSDN.


Read All Questions :-asp.net interview questions part-(1 to 8)
You have gain more knowledge

Visit Daily 

 best of luck !

No comments:

Post a Comment