What is data access layer?
Data Access layer is actually a part of Architecture layer. It has 2 tier,3 tier or N tier Layer. Generally we use
3 tier Layer
1) Presentation layer,Business Logic layer and then Data Access Layer. Data Access layer is a medium to talk between database and Business Logic layer.It helps to maintain flexibility,resuablity and even secuity also. In security SQL Injection can be stopped with 3 iter Archietcture.
I have two textboxes one for user name and another for password . i have a table name
compare(which contains name,passwod etc.,)my doubt is how compare username textbox
with name column and how compare password textbox with passwod column. i want the code?
sqlconnection con = new sqlconnection("");
sqlcommand cmd = new sqlcommand("select * from
table-name",con);
//write this code in the button click event
con.open();
dr = cmd.executereader();
while(dr.read())
{
if(textbox1.text==dr.getvalue(0).tostring()&&
textbox2.text==dr.getvalue(1).tostring())
{
msgbox.show("successful");
}
}
con.close();
else
{
msgbox.show("not success");
}
What are the different row versions available in table?
There are four types of Row versions.
Current:
The current values for the row. This row version does not exist for rows with a RowState of Deleted.
Default :
The row the default version for the current DataRowState. For a DataRowState value of Added,
Modified or Current, the default version is Current. For a DataRowState of Deleted, the version is Original.
For a DataRowState value of Detached, the version is Proposed.
Original:
The row contains its original values.
Proposed:
The proposed values for the row. This row version exists during an edit operation on a row, or for a
row that is not part of a DataRowCollection.
What are the two fundamental objects in ADO.NET?
Datareader and Dataset are the two fundamental objects in ADO.NET
What we do with the object of ado.net dataset after using it?Can we dispose it or can we
set it nothing?Is it must or not?
we use dispose
What provider ADO.net use by default ?
Ado.net uses no Dataprovider by default and this is absulotely correct answere. there is no other choice for this question
How you will set the data relation between two columns?
ADO.NET provides DataRelation object to set relation between two columns.It helps to enforce the
following constraints,a unique constraint, which guarantees that a column in the table contains no
duplicates and a foreign-key constraint,which can be used to maintain referential integrity.
A unique constraint is implemented either by simply setting the Unique property of a data column to true,
or by adding an instance of the UniqueConstraint class to the DataRelation object's ParentKeyConstraint.
As part of the foreign-key constraint, you can specify referential integrity rules that are applied at three
points,when a parent record is updated,when a parent record is deleted and when a change is accepted or rejected.
DataSet d = new DataSet();
DataColumn parentDC = new DataColumn(d.Tables["parentTable"].Columns["id"]);
DataColumn childDC = new DataColumn(d.Tables["ChildTable"].Columns["id"]);
DataRelation ds = new DataRelation("relation name",parentDC, childDC);
d.Relations.Add(ds);
What is the provider and namespaces being used to access oracle database?
The provider name is oledb and the namespace is system.data.oledb
Explain acid properties?
The term ACID conveys the role transactions play in mission-critical applications. Coined by transaction
processing pioneers, ACID stands for atomicity, consistency, isolation, and durability.
These properties ensure predictable behavior, reinforcing the role of transactions as all-or-none
propositions designed to reduce the management load when there are many variables.
Atomicity
A transaction is a unit of work in which a series of operations occur between the BEGIN TRANSACTION
and END TRANSACTION statements of an application. A transaction executes exactly once and is atomic ?all the work is done or none of it is.
Operations associated with a transaction usually share a common intent and are interdependent.
By performing only a subset of these operations, the system could compromise the overall intent of the
transaction. Atomicity eliminates the chance of processing a subset of operations.
Consistency
A transaction is a unit of integrity because it preserves the consistency of data, transforming one
consistent state of data into another consistent state of data.
Consistency requires that data bound by a transaction be semantically preserved. Some of the responsibility for maintaining consistency falls to the application developer who must make sure that all known integrity constraints are enforced by the application. For example, in developing an application that transfers money, you should avoid arbitrarily moving decimal points during the transfer.
Isolation
A transaction is a unit of isolation ? allowing concurrent transactions to behave as though each were the only transaction running in the system.Isolation requires that each transaction appear to be the only transaction manipulating the data store, even though other transactions may be running at the same time. A transaction should never see the intermediate stages of another transaction.
Transactions attain the highest level of isolation when they are serializable. At this level, the results obtained
from a set of concurrent transactions are identical to the results obtained by running each transaction serially.
Because a high degree of isolation can limit the number of concurrent transactions, some applications reduce
the isolation level in exchange for better throughput.
Durability
A transaction is also a unit of recovery. If a transaction succeeds, the system guarantees that its updates
will persist, even if the computer crashes immediately after the commit. Specialized logging allows the system's
restart procedure to complete unfinished operations, making the transaction durable.
Which method do you invoke on the DataAdapter control to load your generated dataset with data?
SqlDataAdapter adap=new SqlDataAdapter("Select * from temp",Conn);
DataSet ds = new DataSet();
//Here we load the table to dataset
adap.Fill(ds);
What are the attirbutes of DataSet?
DataSet
DataTabel
DataColumns
Datarow
DataPrimaryKey
DataForgeinKey
What is data Adapter?
Data adapter is bridge between Connection and DataSet , Data adapter in passing the sql query and fill in dataset
How to find the count of records in a dataset?
DS.Tables["tabname"].Rows.Count;
we can get count of the records.
No comments:
Post a Comment