26.02.2015 Views

DOT NET Interview Questions - DotNetSpider

DOT NET Interview Questions - DotNetSpider

DOT NET Interview Questions - DotNetSpider

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

lstdata.DataSource = objDataSet.Tables("Table1").DefaultView<br />

In order to refer “Table1” DataTable , use Tables collection of DataSet and the Defaultview<br />

object will give you the necessary output.<br />

(B) How can we add relation’s between table in a DataSet ?<br />

Dim objRelation As DataRelation<br />

objRelation=New<br />

DataRelation("CustomerAddresses",objDataSet.Tables("Customer").Columns("Custid")<br />

,objDataSet.Tables("Addresses").Columns("Custid_fk"))<br />

objDataSet.Relations.Add(objRelation)<br />

Relation’s can be added between “DataTable” object’s using the “DataRelation”<br />

object.Above sample code is trying to build a relationship between “Customer” and<br />

“Addresses” “Datatable” using “CustomerAddresses” “DataRelation” object.<br />

(B) What’s the use of CommandBuilder ?<br />

CommandBuilder builds “Parameter” objects automatically.Below is a simple code which<br />

uses commandbuilder to load its parameter object’s.<br />

Dim pobjCommandBuilder As New OleDbCommandBuilder(pobjDataAdapter)<br />

pobjCommandBuilder.DeriveParameters(pobjCommand)<br />

Be careful while using “DeriveParameters” method as it needs a extra trip to the Datastore<br />

which can be very inefficient.<br />

(B) What’s difference between “Optimistic” and<br />

“Pessimistic” locking ?<br />

In pessimistic locking when user wants to update data it locks the record and till then no<br />

one can update data.Other user’s can only view the data when there is pessimistic locking.<br />

In optimistic locking multiple user’s can open the same record for updating , thus increase<br />

maximum concurrency.Record is only locked when updating the record.This is the most<br />

190

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!