Fiserv Most Frequently Asked Latest ASP.NET Interview Questions Answers

How Can We Add Relation Between Tables In A Dataset?

Dim objRelation As DataRelation
objRelation=New
DataRelation("CustomerAddresses",
objDataSet.Tables("Customer").Columns("Custid")
,objDataSet.Tables("Addresses").Columns("Custid_fk"))
objDataSet.Relations.Add(objRelation)
Relations can be added between “Data Table” objects using the “Data Relation” object.

Above sample, code is trying to build a relationship between “Customer” and “Addresses” “Data table” using “Customer Addresses” “Data Relation” object.

What Is The Use Of Command Builder?

Command Builder builds “Parameter” objects automatically. Below is a simple code, which uses command builder to load its parameter objects.

Dim pobjCommandBuilder As New OleDbCommandBuilder(pobjDataAdapter)
pobjCommandBuilder.DeriveParameters(pobjCommand)
Be careful while using “Derive Parameters” method as it needs an extra trip to the Data store, which can be very inefficient

How Can We Perform Transactions In .net?

The most common sequence of steps that would be performed while developing a transactional application is as follows

Open a database connection using the Open method of the connection object.
Begin a transaction using the Begin Transaction method of the connection object.
This method provides us with a transaction object that we will use later to commit or rollback the transaction. Note that changes caused by any queries executed before calling the Begin Transaction method will be committed to the database immediately after they execute. Set the Transaction property of the command object to the above mentioned transaction object.

Execute the SQL commands using the command object. We may use oneormorecommand objects for this purpose, as long as the Transaction property of all the objects is set to a valid transaction object.
Commit or roll back the transaction using the Commit or Rollback method of the transaction object.
Close the database connection.
Fiserv Most Frequently Asked Latest ASP.NET Interview Questions Answers
Fiserv Most Frequently Asked Latest ASP.NET Interview Questions Answers

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 Maximum Pool Size In Ado.net Connection String?

Maximum pool size decides the maximum number of connection objects to be pooled. If the maximum pool size is reached and there is no usable connection available the request is queued until connections are released back in to pool. So it’s always a good habit to call the close or dispose method of the connection as soon as you have finished work with the connection object.

How To Enable And Disable Connection Pooling?

For .NET it is enabled by default but if you want to just make sure set Pooling=true in the connection string. To disable connection pooling set Pooling=false in connection string if it is an ADO.NET Connection.

If it is an OLEDBConnection object set OLE DB Services=-4 in the connection string.

What Is The Namespace In Which .net Has The Data Functionality Class?

Following are the namespaces provided by .NET for data management:-

System. Data
This contains the basic objects used for accessing and storing relational data, such as DataSet, DataTable, and Data Relation. Each of these is independent of the type of data source and the way we connect to it.

System.Data.OleDB
It contains the objects that we use to connect to a data source via an OLE-DB provider, such as OleDbConnection, OleDbCommand, etc. These objects inherit from the common base classes, and so have the same properties, methods, and events as the SqlClient equivalents.

System.Data.SqlClient
This contains the objects that we use to connect to a data source via the Tabular Data Stream (TDS) interface of Microsoft SQL Server (only). This can generally provide better performance as it removes some of the intermediate layers required by an OLE-DB connection.

System.XML
This Contains the basic objects required to create, read, store, write, and manipulate XML documents according to W3C recommendations.

What Are Major Difference Between Classic Ado And Ado.net?

Following are some major differences between both :-

 In ADO we have recordset and in ADO.NET we have dataset.
In recordset we can only have one table. If we want to accommodate more than one tables we need to do inner join and fill the recordset. Dataset can have multiple tables.
All data persist in XML as compared to classic ADO where data persisted in Binary format also.

What Is The Use Of Connection Object?

They are used to connect a data to a Command object.

An OleDbConnection object is used with an OLE-DB provider
A SqlConnection object uses Tabular Data Services (TDS) with MS SQL Server.

How Can We Connect To Microsoft Access, Foxpro, And Oracle Etc?

Microsoft provides System.Data.OleDb namespace to communicate with databases like success , Oracle etc. In short, any OLE DB-Compliant database can be connected using System.Data.OldDb namespace.

Private Sub loadData()
Dim strPath As String
strPath = AppDomain.CurrentDomain.BaseDirectory
Dim objOLEDBCon As New
OleDbConnection(“Provider=Microsoft.Jet.OLEDB.4.0;
Data Source =” & strPath & “Nwind.mdb”)
Dim objOLEDBCommand As OleDbCommand
Dim objOLEDBReader As OleDbDataReader
Try
objOLEDBCommand = New OleDbCommand(“Select FirstName from Employees”)
objOLEDBCon.Open()
objOLEDBCommand.Connection = objOLEDBCon
objOLEDBReader = objOLEDBCommand.ExecuteReader()
Do While objOLEDBReader.Read()
lstNorthwinds.Items.Add(objOLEDBReader.GetString(0))
Loop
Catch ex As Exception
Throw ex
Finally
objOLEDBCon.Close()
End Try
End Sub

The main heart is the “Load data ()” method which actually loads the data in list box.

What Does Top Operator Do?

The TOP operator is used to specify the number of rows to be returned by a query. The TOP operator has new addition in SQL SERVER 2008 that it accepts variables as well as literal values and can be used with INSERT, UPDATE, and DELETES statements.

What Is Cte?

CTE is an abbreviation of Common Table Expression. A Common Table Expression (CTE) is an expression that can be thought of as a temporary result set which is defined within the execution of a single SQL statemnt. A CTE is similar to a derived table in that it is not stored as an object and lasts only for the duration of the query.

What Is Merge Statement?

MERGE is a new feature that provides an efficient way to perform multiple DML operations. In previous versions of SQL Server, we had to write separate statements to INSERT, UPDATE, or DELETE data based on certain conditions, but now, using MERGE statement we can include the logic of such data modifications in one statement that even checks when the data is matched then just update it and when unmatched then insert it. One of the most important advantages of MERGE statement is all the data is read and processed only once.

What Is Filtered Index?

Filtered Index is used to index a portion of rows in a table that means it applies filter on INDEX which improves query performnce, reduce index maintenance costs, and reduce index storage costs compared with full‐table indexes. When we see an Index created with some where clause then that is actually a FILTERED INDEX.

Which Are New Data Types Introduced In Sql Server 2008?

The GEOMETRY Type: The GEOMETRY data type is a system .NET common language runtime (CLR) data type in SQL Server. This type represents data in a two‐dimensional Euclidean coordinate system.

The GEOGRAPHY Type: The GEOGRAPHY datatype’s functions are the same as with GEOMETRY. The difference between the two is that when you specify GEOGRAPHY, you are usually specifying points in terms of latitude and longitude.

New Date and Time Datatypes: SQL Server 2008 introduces four new datatypes related to date and time: DATE, TIME, DATETIMEOFFSET, and DATETIME2.

DATE: The new DATE type just stores the date itself. It is based on the Gergorian calendar and handles years from 1 to 9999.
TIME: The new TIME (n) type stores time with a range of 00:00:00.0000000 through 23:59:59.9999999. The precision is allowed with this type. TIME supports seconds down to 100 nanoseconds. The n in TIME (n) defines this level of fractional second precision, from 0 to 7 digits of precision.
The DATETIMEOFFSET Type: DATETIMEOFFSET (n) is the time‐zone‐aware version of a datetime datatype. The name will appear less odd when you consider what it really is: a date + a time + a time‐zone offset. The offset is based on how far behind or ahead you are from Coordinated Universal Time (UTC) time.
The DATETIME2 Type: It is an extension of the datetime type in earlier versions of SQL Server. This new datatype has a date range covering dates from January 1 of year 1 through December 31 of year 9999. This is a definite improvement over the 1753 lower boundary of the datetime datatype.
DATETIME2 not only includes the larger date range, but also has a timestamp and the same fractional precision that TIME type provides.

What Are The Advantages Of Using Cte?

Using CTE improves the readability and makes maintenance of complex queries easy.
The query can be divided into separate, simple, logical building blocks which can be then used to build more complex CTE's until final result set is generated.
CTE can be defined in functions, stored procedures, triggers or even views.
After a CTE is defined, it can be used as a Table or a View and can SELECT, INSERT, UPDATE or DELETE Data.

How Can We Rewrite Sub-queries Into Simple Select Statements Or With Joins?

we can write using Common Table Expression (CTE). A Common Table Expression (CTE) is an expression that can be thought of as a temporary result set which is defined within the execution of a single SQL statemnt. A CTE is similar to a derived table in that it is not stored as an object and lasts only for the duration of the query.

E.g.

USE AdventureWorks
GO WITH
EmployeeDepartment_CTE AS(SELECT EmployeeID,DepartmentID,
ShiftID FROM HumanResources.Employee Department History)
SELECT ecte.EmployeeId, ed.Department ID, ed.Name, ecte.ShiftID
FROM HumanResources. Department ed INNER JOIN EmployeeDepartment_CTE
ecte ON ecte. Department ID = ed.Department ID
GO

What Is Clr?

In SQL Server 2008, SQL Server objects such as user‐defined functions can be created using such CLR languages. This CLR language support extends not only to user‐defined functions, but also to stored procedures and triggers. You can develop such CLR add‐ons to SQL Server using Visual Studio 2008.

Post a Comment

Previous Post Next Post