Friday, 11 December 2015

Connected and disconnected mode

Connected and Disconnected Data Access Architecture

The ADO.NET Framework supports two models of Data Access Architecture, Connection Oriented Data Access Architecture and Disconnected Data Access Architecture.
In Connection Oriented Data Access Architecture the application makes a connection to the Data Source and then interact with it through SQL requests using the same connection. In these cases the application stays connected to the database system even when it is not using any Database Operations.
ADO.Net solves this problem by introduces a new component called Dataset. The DataSet is the central component in the ADO.NET Disconnected Data Access Architecture. A DataSet is an in-memory data store that can hold multiple tables at the same time. DataSets only hold data and do not interact with a Data Source. One of the key characteristics of the DataSet is that it has no knowledge of the underlying Data Source that might have been used to populate it.
  DataSet ds = new DataSet();

In Connection Oriented Data Access, when you read data from a database by using a DataReader object, an open connection must be maintained between your application and the Data Source. Unlike the DataReader, the DataSet is not connected directly to a Data Source through a Connection object when you populate it. It is the DataAdapter that manages connections between Data Source and Dataset by fill the data from Data Source to the Dataset and giving a disconnected behavior to the Dataset. The DataAdapter acts as a bridge between the Connected and Disconnected Objects.
  SqlDataAdapter adapter = new SqlDataAdapter("sql", "connection");
  DataSet ds = new DataSet();
adapter.Fill(ds, "Src Table");


By keeping connections open for only a minimum period of time, ADO .NET conserves system resources and provides maximum security for databases and also has less impact on system performance.

Difference between stored procedure and function.


  • Stored Procedure have pre-compiled execuction plan where as functions do not.
  • Functions are used for computations where as procedures are mainly used for performing business logic.
  • Functions can only have 'in' parameter where as SP can have both 'in' and 'out' parameters.
  • Function does not allow DML (insert, update, delete) queries on an object where as SP allows.
  • Functions can be used inline where as SP can't be.
  • Stored Procedure can retun more than one value at a time while funtion returns only one value at a time.
  • Functions MUST return a value, procedures need not be
  • Thursday, 26 November 2015

    Delegate in c#

                Delegate                                                

      Delegate is a special data type that hold the address or reference of a function.


    There are two type of delegate.
    1)single cast delegate.
    2)multi cast delegate.

                        Single cast delegate.


    If we are using delegate object to store single function, then we said that it is single cast delegate.

                         Multi cast delegate.


    If we are using delegate object to store multiple function, then we easily said that it is multi delegate.

                             General syntax of delegate

    #create delegate.

    Access specifiers delegate name of delegate.
    E.g:-
    Public delegate my del();
    #procedure to create object of delegate and hold function into it.
    My del obj1=new My del ();
    #calling of function using delegate object.
    Obj1();= fun 1();

    Tuesday, 17 November 2015

    explanation of definition of ado.net

    Ado means active data object and ado is replaced by ado.net .Ado.net is fully based on oops concept.
    ADO.NET is a set of computer software components that programmers can use to access data and data services based on disconnected DataSets and XML. It is a part of the base class library that is included with the Microsoft .NET Framework. It is commonly used by programmers to access and modify data stored in relational database systems, though it can also access data in non-relational sources. ADO.NET is sometimes considered an active x data object.

    Sunday, 1 November 2015

    difference between interface and abstract class.

    Difference between interface and abstract class

    Interface provide pure abstract methods.
    Abstract class provide concrete classes.

    Interface provide multiple inheritance.
    Abstract class don't provide multiple inheritance.

    We cannot create object of interface, we create only reference variable of interface.
    We create object of abstract class.

    We cannot define data field within interface.
    In abstract class we have to define data field. 

    We cannot use any access specifier within interface.
    We can use access specifier with abstract class.

    Friday, 16 October 2015

    difference between c++ and c#.


    • C++ support operator overloading.
    • C# does not support operator overloading.
    • C++ contains header files.
    • C# contains namespaces.
    • C++ support multiple inheritance.
    • C# does not support multiple inheritance because it support interface.

    Saturday, 5 September 2015

    static in c#.net

    Static
    static is a keyword that behaves like type modifier.
    static works again oop and beyond the oops.
    static member are guest for a class.
    A static variable created only once in complete program whenever
    class is invoked only when application is closed.
    Example:-
    class class1
    {
    public int a,b;
    public static int c;
    public static int count=0;
    public class1()
    {
    count++
    message box.show("convert.To string")
    }






    class1 ob1=new class();
    class1.c=25;