net interview questions wid answers

download net interview questions wid answers

of 20

  • date post

    24-Aug-2014
  • Category

    Documents

  • view

    113
  • download

    2

Embed Size (px)

Transcript of net interview questions wid answers

ADO.NETSunday, January 15, 2012 What is the difference between Execute Reader, Execute Scalar and Execute Non Query methods?Execute Reader Execute Reader will be used to return the set of rows, on execution of SQL Query or Stored procedure using command object. Execute Scalar Execute Scalar will be used to return the single value, on execution of SQL Query or Stored procedure using command object. Execute Non Query If the command or stored procedure performs INSERT, DELETE or UPDATE operations, then we use Execute Non Query method. Execute Non Query method returns an integer specifying the number of rows inserted, deleted or updated.

What are the different steps to access a database through ADO.NET?Create a connection to the database using a connection object. Open the Database Connection. Invoke a command to create a Dataset object using an adapter object. Use the Dataset object in code to display data or to change items in the database. Invoke a command to update the database from the Dataset object using an adapter object. Close the database connection.

What are the Benefits of ADO.Net?ADO.Net offers following Benefits Interoperability: XML Format is one of the best formats for Interoperability.ADO.NET supports to transmit the data using XML format. Scalability: ADO.NET works on Dataset that can represent a whole database or even a data table as a disconnected object and thereby eliminates the problem of the constraints of number of databases being connected. In this way scalability is achieved. Performance: The performance in ADO.NET is higher in comparison to ADO that uses COM marshalling. Programmability: ADO.Net Data components in Visual studio help to do easy program to connect to the database.

What is Microsoft ADO.NET?ADO.NET is one of the component in the Microsoft.NET framework which contains following features to Windows, web and distributed applications. i. Data Access to the applications from Database in connected (Data reader object) and disconnected (Data set and data table) model. ii. Modify the data in database from application.

What are advantages and disadvantages of Microsoft-provided data provider classes in ADO.NET?SQLServer.NET data provider is high-speed and robust, but requires SQL Server license purchased from Microsoft. OLEDB.NET is universal for accessing other sources, like Oracle, DB2, Microsoft Access and Informix, but it's a .NET layer on top of OLE layer, so not the fastest thing in the world. ODBC.NET is a deprecated layer provided for backward compatibility to ODBC engines.

1

Difference between Association rule mining and frequent itemset miningAn association rule is something like "A,B ? C", meaning that C tends to occur when A and B occur. An itemset is just a collection such as "A,B,C", and it is frequent if its items tend to co-occur. The usual way to look for association rules is to find all frequent itemsets and then postprocess them into rules

Named out assemblies and corresponding namespace of all .Net framework data provider.a) .Net Framework Data Provider for SQL Server Assembly Name :- System.Data.dll NameSpace :- System.Data.SqlClient b) .Net Framework Data Provider for OLE DB Server Assembly Name :- System.Data.dll NameSpace :- System.Data.OleDb

C) .Net Framework Data Provider for ODBC Assembly Name :- System.Data.ODBC

C) .Net Framework Data Provider for Oracle Assembly Name :- System.Data.OracleClient.dll NameSpace :- System.Data.OracleClient

What are different .Net framework data provider.The Four main types of .net framework data provider are a) .Net framework data provider for SQL server. b) .Net framework data provider for OLEDB c) .Net framework data provider for ODBC d) .Net framework data provider for Oracle.

List out Some feature of ADO.net The Key feature of ADO.Net area) Disconnected Data Architecture b) Data cached in datasets c) Scalability d) Data transfer in XML format.

What is Difference between SqlCommand and SqlCommandBuilderSQLCommand is used to execute all kind of SQL queries like DML(Insert, update,Delete) & DDL like(Create table, drop table etc) where as SQLCommandBuilder object is used to build & execute SQL (DML) queries like select, insert, update & delete.

What is the Use of Connection Object ?In order to interact with any database we need a Connection . This connection enables us to know the Server Name, UserId,Password,Database Name. These are the main requirements to connect to a Database. So in our Connection string we provide all those above mentioned properties as parameters.

Different Connection objects : SqlConnection, OleDbConnection, OdbcConnection

. OleDbConnection object is used with an OLE-Db Provider

2

OleDbConnection cnn ; connetionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=DatabaseName;"; cnn = new OleDbConnection(connetionString); . SqlConnection object used the Tabular Data Services (TDS) With MS Sql Server.

SqlConnection con; con = new SqlConnection("server=SERVER NAME;user id=ID;password=PASSWORD;database=DB NAME"); SqlCommand cmd; cmd = new SqlCommand("DB Query Here",con); . Using the OdbcConnection , we will create an OdbcCommand. From that command we can issue a Query and create an OdbcDataReader.

OdbcConnection DbConnection = new OdbcConnection("Connection String"); OdbcCommand DbCommand = DbConnection.CreateCommand(); DbCommand.CommandText = "Db Query Here"; OdbcDataReader DbReader = DbCommand.ExecuteReader();

What is the use of dataview?Data view is used to sort and find data in a data table.

What is the use of data adapter?These objects connect one or more Command objects to a Dataset object. They provide logic that would get data from the data store and populates the tables in the Dataset, or pushes the changes in the Dataset back into the data store. . An OleDbDataAdapter object is used with an OLE-DB provider . A SqlDataAdapter object uses Tabular Data Services with MS SQL Server.

What are the two fundamental objects in ADO.NET?Data reader and Dataset are the two fundamental objects in ADO.NET.

What are the benefits of ADO.NET?BENEFITS OF ADO.NET

1>Scalability:ADO.NET works on DataSet that can represent a whole database or even a data table as a disconnected object and thereby eliminates the problem of the constraints of number of databases being connected. In this way scalability is achieved. 2>Data Source Independence:In ADO.NET DataSet is completely independent of data source and no way DataSet is controlled by the data source as it happens

3

in case of RecordSet. 3>Interoperability:As ADO.NET transmits the data using the format of XML which is not dependent on ADO.NET or windows platform. 4>Strongly Typed Fields:It supports strongly typed fields by using CTS. 5>Performance:The performance in ADO.NET is higher in comparison to ADO that uses COM marshalling. 6>Firewall: As in ADO.NET transmission is via XML format, therefore it can pass through firewalls.

What is GetSchemaTable() in ADO.NETThe GetSchemaTable method returns a DataTable property that contains the column schema for a DataReader. The DataTable contains one row for each field in the resultset. Each column maps to a property of the field in the resultset. The ColumnName property of the DataTable column is the name of the field's property, such as the ColumnName, DataType, ColumnSize, IsKeyColumn, or IsAutoIncrement property. The value of the DataTable column is the value of the field's property, such as the FirstName value for the ColumnName property.

ado VS ado.Net*)ado is connected mode always where as ado.net is connected as well as disconnected. *)ado ---recordset whereas ado.net ---dataset *)ado---c,c++whereas ado.net---- .net framework *)ado--server based whereas ado.net --client

What is Dataset?A DataSet is Disconnected Architecture,means their is no need to always open & close connection. It is cache of data retrieved from database. It is made up of collection of datatable. Dataset can be Typed & UnTyped usually, datasets are typed in Visual basic.A typed dataset is dataset which derived from dataset class & uses information in XML schema file(XSD file).An untyped dataset has no built in schema.it can contain tables,column & rows.but those are exposed only as collections

What is the default TimeOut for a SqlCommand.CommandTimeout property?

The default timeOut is 30 seconds. If you want to increase the TimeOut see the below example code For example:SqlCommand cmd = new SqlCommand("select * from tablename", conn); cmd.CommandTimeout = 50; SqlDataReader dr = cmd.ExecuteReader();

What is a DataSet?The Dataset is the central object in ADO.NET. DataSet is a nogical container of data. It represents a set of data tables referenced as one unit in the application. With this object you can get all the data you need from each table quickly, examine and change it while you are disconnected from the server and then update the server with changes in an efficient operation.

4

How to fill DataSet with data?To fill DataSet with data we have to use Fill() method of DataAdapter object. Fill() has several overloads. But the simple one is [CODE]Fill(DataSet, DataTable)[/CODE] The first parameter will take the name of the dataset to be filled and the second parameter specifies the name of the DataTable in the DataSet which will contain the data.

what is difference Between datareader and dataset ?DataReader =========== DataReader is like a forward only recordset. It fetches one row at a time so very less network cost compare to DataSet(Fethces all the rows at a time). DataReader is readonly so we can't do any transaction on them. DataReader will be the best choice where we need to show the data to the user which requires n