Posts

Showing posts from December, 2012

Dataset in ado

Image
The ADO.NET DataSet contains DataTableCollection and their DataRelationCollection . It represents a collection of data retrieved from the Data Source. We can use Dataset in combination with DataAdapter class. The DataSet object offers a disconnected data source architecture. The Dataset can work with the data it contain, without knowing the source of the data coming from. That is , the Dataset can work with a disconnected mode from its Data Source . It gives a better advantage over DataReader , because the DataReader is working only with the connection oriented Data Sources. The Dataset contains the copy of the data we requested. The Dataset contains more than one Table at a time. We can set up Data Relations between these tables within the DataSet. The data set may comprise data for one or more members, corresponding to the number of rows. The DataAdapter object allows us to populate DataTables in a DataSet. We can use Fill method of the DataAdapter for populating data i...

Delegate

A delegate is an important element of C# and is extensively used in every type of .NET application. A delegate is a class whose object (delegate object) can store a set of references to methods. This delegate object is used to invoke the methods. Many developers find delegates complicated. But believe me, it’s a simple concept to understand. In this article we will see how delegates work and in what situations they are used. Let’s start with a simple program that shows how to declare and use a delegate. class sample {                           delegate void del1();                           delegate void del2 (int i);                   ...

Virtual Function

Virtual functions (C++ only) By default, C++ matches a function call with the correct function definition at compile time. This is called   static binding . You can specify that the compiler match a function call with the correct function definition at run time; this is called   dynamic binding . You declare a function with the keyword   virtual   if you want the compiler to use dynamic binding for that specific function. The following examples demonstrate the differences between static and dynamic binding. The first example demonstrates static binding: #include <iostream> using namespace std; struct A {    void f() { cout << "Class A" << endl; } }; struct B: A {    void f() { cout << "Class B" << endl; } }; void g(A& arg) {    arg.f(); } int main() {    B x;    g(x); } The following is the output of the above example: Class A When fun...