What are the fundamental differences between value types and reference types?
C# divides types into two categories – value types and reference types. Most of the intrinsic types (e.g. int, char) are value types. Structs are also value types. Reference types include classes, arrays and strings. The basic idea is straightforward – an instance of a value type represents the actual data, whereas an instance of a reference type represents a pointer or reference to the data.The most confusing aspect of this for C++ developers is that C# has predetermined which types are represented as values, and which are represented as references. A C++ developer expects to take responsibility for this decision
How to save data from dataset?
The modified data needs to be sent back to the database in order to save it. Therefore, to send the modified data to a database, the Update method of a TableAdapter or data adapter needs to be called. The Update method executes either of INSERT, UPDATE, or DELETE depending on the RowState in the table.
In Visual Studio a TableAdapterManager component is used for saving the proper order based on the foreign-key constraints of the database.
Although the procedure to save the data may change depending upon the applications, the following steps throw light on the generalized concept:
The code sends updates to the database should be written within a try/catch block.
The data row should be located to determine the problem area and the code should then be reattempted.
What are the various objects in Dataset?
The DataSet class exists in the System.Data namespace. The Classes contained in the DataSet class are:
DataTable
DataColumn
DataRow
Constraint
DataRelation.
Database Interview: Difference between Index defrag and Index rebuild?
When you create an index in the database, the index information used
by queries is stored in index pages. The sequential index pages are
chained together by pointers from one page to the next. When changes
are made to the data that affect the index, the information in the
index can become scattered in the database. Rebuilding an index
reorganizes the storage of the index data (and table data in the case
of a clustered index) to remove fragmentation. This can improve disk
performance by reducing the number of page reads required to obtain
the requested data
DBCC INDEXDEFRAG - Defragments clustered and secondary indexes of the
specified table or view.