Skip to main content

ADO.Net

ADO.Net Components:
Connection, Command, DataReader, DataAdapter

Differentiate between DataSet and RecordSet:
1) DataSet is entire relation DB in memory. Table/Relation/Views While RecordSet is representation of Table. It do not contain information on relationships, Constraints, Keys.
2) DataSet is designed to work in disconnected mode.
3) There’s no concept of cursor-types in a DataSet
4) DataSet has no record pointer.
5) You can store many edits in a DS and write them in Original DataSource in a single call.
6) DataSet internally represents data with XML and can be serialized. Thus you can easily retrieve data from a DB and then write directly to XML file or reverse.

DataSet is always disconnected?
True


What is advantage of DataReader over DataSet?
DataReader is readonly stream of data returned from the DB as the query executes. It contains one row of data at a time and is restricted to forward-only. Supports to a access multiple result sets but only one at a time and in order retrieved. DataReader needs connection to DB throughout its usage. DataReader is faster than DataSet.

Typed DataSet?
Data access is normally done using indexes on collection in object model. In ADO.Net it is possible to create a variation on a Dataset that supports syntax like DataSet.TableName.Rows(0).ColumnName . Errors in syntax are detected during compile time rather than runtime.
Advantages: Data Designer generates typed ds. When we type ds. We get all table names and column names on row. We do not need to remember.

How to reflect updation of data in dataset to database?
Dim ds As New (Typed)DataSet
Dim da As New SqlDataAdapter(“Select Command”)
Dim cd As New SqlCommandBuilder(da)
da.Update(DataTable/DataSet, srcTable)
If SELECT command is SP and to update/insert/delete we have created SPs
We can create SqlCommand Objects in Code and assign it to InsertCommand,
UpdateCommand and DeleteCommand Property of adapter.

What are Different types of command can be executed?
ExecutedNonQuery, ExecuteScaler, ExecuteReader (In Execute NonQuery we can use transaction. In other Scaler and Reader we can not use transaction. We do not need to assign transaction to every command if connection string has ENLIST=true; it automatically assigns current transaction in the Context to the command being executed.

How to Set DataRelation between in two columns:
ds.Relations.Add(DataRelation Object)
New DataRelation(ParentColumns(),childColumns())
New DataRelation("RelationName", ParentColumn, childColumn)
New DataRelation("RelationName", ParentColumn, childColumn, CreateConstraint = True)
New DataRelation("RelationName",ParentColumns(),childColumns(),CreateConstraint=True)

How do we sort the data from a DataTable:
DataTable.Select(strFilter, strSort) As DataRow()
New DataView(DataTable) and DataView.Sort = “Column1,Column2,...)

How do we get only edited/deleted/inserted records from a DataTable:
DataTable.GetChanges(DataRowState.Added Or
DataRowState.Deleted Or
DataRowState.Modified Or
DataRowState.Detached Or
DataRowState.Unchanged)


How does DataAdapter.Fill Work?
Executes the Execute Reader method and gets the reader.
Reads Each ResultSet using NextResultSet of DataReader From the and Fills the DataTable form the reader. Also creates DataTable if MisingSchemaAction is Add/AddWithKey.

Difference between HTML and XML?
XML : User defined tags. Content driven, End tags required , case sensitive. Quotes required around attributes. Slash required in Empty Tags.

What is XSLT and its usage?
XSL Transformations. Used to transform XML document to any other text format such as HTML, text, XML etc.


Comments

Popular posts from this blog

Top Open Source Web-Based Project Management Software

This is an user contributed article. Project management software is not just for managing software based project. It can be used for variety of other tasks too. The web-based software must provide tools for planning, organizing and managing resources to achieve project goals and objectives. A web-based project management software can be accessed through an intranet or WAN / LAN using a web browser. You don't have to install any other software on the system. The software can be easy of use with access control features (multi-user). I use project management software for all of our projects (for e.g. building a new cluster farm) for issue / bug-tracking, calender, gantt charts, email notification and much more. Obviously I'm not the only user, the following open source software is used by some of the biggest research organizations and companies world wild. For example, NASA's Jet Propulsion Laboratory uses track software or open source project such as lighttpd / phpbb use re

Google products for your Nokia phone

Stay connected with Gmail, Search, Maps and other Google products. Check products are available for your Nokia phone Featured Free Products Search - Find the information you need quickly and easily Maps - Locate nearby businesses and get driving directions Gmail - Stay connected with Gmail on the go YouTube - Watch videos from anywhere Sync - Synchronize your contacts with Google

My organization went through the approval process of supporting the .NET Framework 2.0 in production. Do we need to go through the same process all...

My organization went through the approval process of supporting the .NET Framework 2.0 in production. Do we need to go through the same process all over again for the .NET Framework 3.0? Do I need to do any application compatibility testing for my .NET Framework 2.0 applications? Because the .NET Framework 3.0 only adds new components to the .NET Framework 2.0 without changing any of the components released in the .NET Framework 2.0, the applications you've built on the .NET Framework 2.0 will not be affected. You don’t need to do any additional testing for your .NET Framework 2.0 applications when you install the .NET Framework 3.0.