net frameworks1

26
.NET Frameworks 1. Windows forms (system.windows.forms) 2. Web Forms and Web Services 3. Data 4. Base Class Library (BCL) 5. Common Language Runtime (CLR) Common Language Runtime (CLR): is a run time that manages and executes code written in any language that is supported by the .net platform. Code that is designed to run under the CLR is referred to as managed code. The advantage of CLR include supporting multiple language with cross language inheritance, simplifying application development, providing a safe and reliable execution environment, and simplifying application management and deployment. The Base Class Library in the .NET Framework contains classes that use a dot-syntax naming convention with a naming hierarchy. These classes provide access to loaded class information, encapsulate data structures, and enable security checks. BCLs cover such areas as reflection, security, collections, input/output, code generation, and threading. Reflection: Reflection allows you to obtain information about loaded assemblies and the types defined in them. Security supports permission sets, authorization, authentication, and cryptography. Collections provide various collection classes. IO provides support for working with files and stream types. Code generation provides classes for generating source files in different languages. Threading enables the creation of fast and efficient multi-threaded applications. The data component of the .net framework is represented by ADO.NET. ADO.NET provides support for XML and the disconnected programming model. Web forms allow for easy construction of dynamic user interfaces, and web services make programming functions available over the internet. Web Services are made available over the application of XML called SOAP. System.windows.forms is an extensive class library used for developing traditional windows graphical user interface application.

Upload: perksingh

Post on 16-Dec-2015

213 views

Category:

Documents


0 download

DESCRIPTION

NET Frameworks1

TRANSCRIPT

.NET Frameworks

1. Windows forms (system.windows.forms)

2. Web Forms and Web Services

3. Data

4. Base Class Library (BCL)

5. Common Language Runtime (CLR)

Common Language Runtime (CLR): is a run time that manages and executes code written in any language that is supported by the .net platform. Code that is designed to run under the CLR is referred to as managed code.

The advantage of CLR include supporting multiple language with cross language inheritance, simplifying application development, providing a safe and reliable execution environment, and simplifying application management and deployment.

The Base Class Library in the .NET Framework contains classes that use a dot-syntax naming convention with a naming hierarchy. These classes provide access to loaded class information, encapsulate data structures, and enable security checks.

BCLs cover such areas as reflection, security, collections, input/output, code generation, and threading.

Reflection: Reflection allows you to obtain information about loaded assemblies and the types defined in them.

Security supports permission sets, authorization, authentication, and cryptography.

Collections provide various collection classes.

IO provides support for working with files and stream types.

Code generation provides classes for generating source files in different languages.

Threading enables the creation of fast and efficient multi-threaded applications.

The data component of the .net framework is represented by ADO.NET. ADO.NET provides support for XML and the disconnected programming model.

Web forms allow for easy construction of dynamic user interfaces, and web services make programming functions available over the internet. Web Services are made available over the application of XML called SOAP.

System.windows.forms is an extensive class library used for developing traditional windows graphical user interface application.

ASP Disadvantages:

ASP is written in scripted languages, which are interpreted. The scripting code in an ASP files is interpreted the first time the file is requested, and subsequent requests are threaded. The interpretation of ASP code results in a reduction in performance and scalability compared to compiled code.

Due to the fact that the ASP Code must be interpreted for performance, developers often rewrite some of the code in a language that can be complied in the form of COM objects. However, it is very difficult to deploy COM object in ASP.

ASP stores the script code and HTML for a web page in one file. This means that if a designer makes any changes to the page design after its ASP has been coded, they may break the ASP script code.

The DLL is stored in the memory, which means that you much stop iis admin and restart the server when you replace the DLL. The downtime is amplified by the number of web servers in your web farm.

Many simple tasks require you to write code in ASP. Examples include validating form fields and maintaining form state.

Session state allows you to share state information across requests. ASP does not encourage state management and does not facilitate the sharing of information across web farm servers. Consequently, you will run into difficulty if you try to host your application on more than one server.

You can only update files when the web server is down. Your web application components are in use while the web server is running, and these components must be made unavailable before you can update your files.

ASP.NET

ASP.NET is a completely restructed platform for programming dynamic web applications, many of the problems that have been associated with ASP have been repaired in ASP.NET, which also offers an enhanced version of previous ASP strong points. This topic covers the features of ASP.NET.

Unlike asp pages, which use the .asp extension, asp.net pages use the .aspx extension. This allows developers to write cleaner code that is easily shared and reused.

Features:

Multiple language support, increased performance, classes and namespaces, server controls, web services, multiple types of login and user authentication, greater scalability, cookie-less sessions.

ASP.NET offers access to over 20 languages when building .net applications. It acts as a language=neutral framework upon which to build web applications. Examples include vb and jscript.

You can expect a rapid response from asp.net when you first request a page, the code and the page is compiled by the run time and a copy is cached. When the same page is requested for a second time, the cached copy is used, accelerating the response time.

ASP.NET contains a range of useful classes and namespaces. Namespaces resemble class libraries, and classes represent the components of program that can be used by other programs and applications, Namespaces simplify web application writing, and classes are contained within namespaces.

Server controls make the creation of web pages easier. They do this by encapsulating common functions. Server controls supply a clean programming mode by exposing methods, properties, and evens to server-side code. They can also validate user input and display tables and calendars.

You can create and use web services by using ASP.NET web services provide the blocks for building distributed web-based applications.

ASP.NET allows you to use multiple types of login and user authentication, such as windows, cookies, and passport. In addition, it allows the server to impersonate a user executing code. ASP.NET also allows you to grant users permissions for specific tasks, which can be programmatically tracked.

ASP.NET grants greater scalability by allowing you to add more web servers as your traffic increases. This is possible because session state can be maintained in a separate process on a separate computer or in a database that allows cross-server sessions.

You can also have cookie-less sessions because asp.net allows you to use a session state with browsers that do not have cookie enabled. Uniform resource locators pass the session id on the asp.net page.

Procession Model:

The components of the page processing model include the parser, complier, assembly cache, memory, and output cache. These components are used when asp.ent pages are requested by a client browser. This topic presented the components of the page processing model.

The first part of the mode that is encountered when a page is requested for the first time is the parser. The parser checks and interprets the source code before passing the page on to the complier.

When the complier is invoked, it complies the contents of the page into an intermediate language. The IL is code in an assembly language that is executed by the CLR. Next, the assembly cache retains the native code versions of precompiled pages. The assembly cache is a code cache present on every computer that has the .net framework installed. The memory component of the page processing mode stores items that may be required during later requests. This reduces the cost of the process because the items do not need to be reconstructed for each subsequent request.

Finally, the output cache stores pages that have already been built. This component greatly reduces page request time because once a page has been requested and built, additional requests for that page bypass the parser, complier, assemble cache, and memory components and move directly to the output cache.

Web Forms:

Web forms denote the asp framework that allows you to create programmable web pages. Web forms are created from separate components that form a unit. In this topic, you learn about features of web forms.

Web forms allow you to use any programming language that targets the .net framework. This enables the creation of programmable web pages that use a robust and highly functional set of server side controls.

Web forms are capable of running of any browser, and the server controls are aware of which browser is used. These controls generate HTML in the version supported by the browser. This reduces the need to code different versions for different browsers.

Web applications are divided into a visual component and a user interface logic. This enhances performance and simplifies development. The visual component represents the html markup, and the logic represents the code for page.

Web forms are also referred to as aspx pages due to their .aspx extension. They act as containers for the controls and text that is displayed.

The web forms framework is an object model. During the compilation of a web form, the page and its code is parsed by asp.net, and a new class is generated and compiled. This new class contains server controls the code for the page, and the html text in the .aspx file.

Server Controls:

Server controls were introduced in asp.net to perform common server tasks that were previously hand coded by developers. Most of these controls are used specifically in web forms to generate the user interface. This topic presents features of server controls.

The events, properties, and methods of server controls can be examined at run time from the code on the server. This is made possible by the consistent object mode for the controls.

Client-specific html provided by server controls is sent to each client browser. The controls within a web page are identified by declarative tags that contain a runat=server attribute.

You can identify an individual server control in asp.net by using its id attribute value. This value allows you to identify the control, which enables you to programmatically manipulate the server control.

Server controls eliminate the need to create separate web pages for each type of browser, or query what type of browser is being used. The controls decide what type of client they are dealing with and generate code as necessary.

The form that is requested for user interaction in an application is created, and the controls required for the specific tasks are placed in this form. When the user interacts with the controls of the page, events are raised that must be handled, for this reason, event handlers are created.

Server controls accommodate this event0driven architecture. When a button is clicked on a page, the control values of that page are sent back to the server and a server click event is raised. An event handler subsequently reacts to the click event and performs the appropriate code.

Event handlers provide web page developers with an easy way to structure logic within an asp.net page. Multiple control action events that are raised from different controls can be handled, therefore simplifying the process.

Server controls also enable multiple page navigation. They allow you to navigate to a target page while bypassing custom query string parameters. You can then access these query string parameters from the target page.

Server Controls: Types

Server controls can be used in web forms to generate the user interface. The two types of server controls in asp.net are html server controls and web server controls. This topic covers the types of asp.net server controls.

HTML server controls create the required HTML on the client. They are identical to html with the exception that they have a runat=server attribute value pair. Html server controls also have an id attribute that allows you to identify the control and enables you to programmatically manipulate the server control.

Web server controls are a set of server controls that have a standardized set of property names to simplify web page creation and design. Web server controls exist within the system.web.ui.webcontrols namespace.

These are several categories within web server controls. These are list, rich and validation. In addition, mobile server controls exhibit the same functionality as web server controls, they support mobile and small-screen devices. To learn more about the web server control categories, point to each category.

List: List server controls allow you to produce lists on the client.

Rich: Rich server controls allow the production of complex interface elements on the client.

Validation: Validation server controls allow you to check and validate the values entered in other server controls on a page.

Web server controls appear in html markup as tags with a prefix. The asp prefix maps the tage to the namespace of the run time component, which is system.web.ui.webcontrols. The remainder of the tage is the name of the run time class.

HTML Server Controls:

HTML Server controls are server-based equivalents of standard html that have the same attributes as html. These server controls create html for the client. This topic covers features of asp.net html server controls. HTML server controls in ASP.NET exist within the system.web.ui.htmlcontrols namespace. Features of html controls include interaction with validation controls and the ability to handle evens in client script.

Html server controls in asp.net exist within the system.web.ui.htmlcontrols namespace. The system.web.ui.htmlcontrols base class contains properties, methods and events that are common to all html controls.

HTML controls are similar in appearance to HTML with the exception that the controls have a runat=server attribute value pair in the opening tag of the html element.

When an HTML element becomes an HTML server control, a .net framework class is created for that element, and its attributes are exposed as properties of the html control. This allows web developers to import an html page authored by a designer and program against selected elements of the page.

The control values of a web form can be automatically managed during postback. Html controls can automatically receive the same values as before the form was submitted to the server, even if the form does not take a direct route to the server.

HTML controls interact with validation controls to allow verification that a user has entered the appropriate information into a control.

WEB CONTROLS

Web controls allow you to produce lists on the client. You can then add data to these lists from xml files, databases, or any other supported data store using minimal lines of code.

List produced on the client provide numerous different display options with features for editing the data in the list and formatting the output.

HTML and client-side script allows the production of complex interface elements and complex task-specific output on the client. The output is automatically modified to match the device that requests a page.

Web controls also facilitate automatic browser detection. They detect browser capabilities and create the appropriate output for basic and rich browsers.

Web controls can simplify client-side or server-side validation when submitting user forms to the server. This allows you to validate the values entered in other controls on a page.

You can also specify whether the event of a control warrants immediate sending to a server or caching for future reference when a form is submitted.

Web controls-like functionality can support mobile and small-screen devices. They achieve this through the use of mobile controls, which change the output of the control based on the client device; Examples of such output include html and wireless markup language (WML).

Server Controls: Executing

Server controls enable server-side events and state maintenance across requests. This means that even handlers and their associated procedures may be called upon by executing an asp.net server controls. In this topic, you learn to sequence the steps in executing an asp.net server controls.

Web controls reside on a web form on an asp.net page. This web form also has the runat=server attribute value pair, which allows the forms to maintain the view state of their controls on an asp.net when a page is submitted to a server, the hidden control maintains control state.

The first step in executing an asp.net server control involves the creation of the action and method attributes of the web form by the asp.net code. These attributes allow the control values to be posted back to the appropriate page.

Then, the code adds unique id and name attributes to the web form. If you want to choose the id and name attributes, you should specify them on the web form tag.

Next, the asp.net code adds a value attribute and a posted text value for each control. This step helps to maintain the state of the server controls.

The final step in executing an asp.net server control involves the addition of a hidden control to the web form. This hidden control is named _viewstate, and it stores the state of a page across multiple requests.

The steps involved in executing a server control begin with the creation of action and method attributes. Then the addition to the web form of unique id and name attributes, a value attribute and a text value, and a hidden control. In this topic you learned to sequence the steps in executing an asp.net server control.

VB.NET has many different features from previous versions that reduce coding errors during development and improve the reliability of the developed application. In this topic, you learned about the new syntactical features of vb.net.

The new syntactical features of vb.net help reduce coding errors during software development and improve the reliability of the developed application.

The first major difference between vb.net and vb is that vb.net the set and let keywords are no longer needed. Since the specific property or method has to be provided, the data type is determined at run time the correct assignment is performed.

The second difference between the versions is that vb.net uses parentheses when calling functions and sub-procedures. Parentheses are used to enclose the parameter list.

3. Vb 6.0 by ref is default. Vb.net by value is default.

In VB you could declare variable generically as a variant type. When declaring variables in vb.net, you have to specify the data type of the variable. Another feature of vb.net.

5. The variables can now be initialized when they are declared. You can now give the variable a value when you are declaring it. Initializers can be used in most situations, including inside a control structure.

6. Vb.net supports new conversion methods, such as tostring, for converting data types. Functions such as cstr can still be used but are usually associated with the older versions of vb.

7. Type safe code only accesses authorized memory locations. A 7th new feature of vb.net is that it has improved type safety by generating errors when a conversion that is unexpected by the user, or when a conversion that could fail at run time, is required.

8. Vb.net also supports structured error handling that uses the try, catch, and finally statements. This enables the developer to avoid writing a lot of duplicated code in consistent error-handling schemes.

Event Handlers:

Server controls have properties, events, and methods that can be accessed at runtime from code running on the server. Even handlers are added to server controls at the design stage. An event handler programmatically responds to the event by calling on a specific portion of code to perform a task.

Page Event life Cycle

A life cycle is a progression through a series of differing stages of development.

Page_init-( Page Load( Control Event ( Page unload

ISPostBack Property

In asp.net the IsPostback property enables handling of postback forms. The Ispostback property is often used to avoid unnecessary code processing. It is designed to identify whether the asp.net form is in a postback situation, or is being loaded for the first time. Usually, the list is only populated from a database the first time the page loads.

The hidden _VIEWSTATE field is a control used in asp.net and maintains the data entered in the form. It maintains the state of the form so that the values previously entered can be redisplayed on postback. Originally in asp, all submitted values that were sent to the server were saved individually, with each being written back onto the postback form one by one. Asp.net uses the hidden _Viewstate field to speed up this process for the developers.

The hidden _VIEWSTATE field maintains form state during postback. It automatically retains all the name value pairs at once, and writes them back into the form fields on postback. This is unlike asp where the developer has to write them back onto the postback form individually.

ADO.NET

ADO has a new object model that uses the power of xml to provide disconnected access for the manipulation of data. Ado.net has been designed to work with disconnected datasets.

Ado.net is not software or hardware specific. A software component can share ado.net data if it uses the same xml schema, which specifies the format of the data. There are no hardware restrictions once the receiving end has access to an xml parser. Disconnected data sets reduce network traffic.

The ado.net object model consists of the same object as ado with some additions. These additional objects include the dataview, dataset, data reader, and data adapter objects.

Ado uses a connection object to connect a data store to a command object. The connections object hold details such as the user name, pwd, and other connection details.

A command object is used to run a stored procedure or a sql statement of a data store through the connection object. This command object can be connected to a datareader object or a data adapter object. A dataadapter object is used to connect to a dataset object.

A dataset object represents a cache of data that acts like a database. It contains tables, columns, relationships, constraints and data. A dataset object can be creaed from existing data in a data store, and tables in the dataset can be manipulated.

A dataset object holds information on the table contents. The original values of a table are stored so that if changes are made they can be pushed back to the original data store. This makes it easy to work in a disconnected environment.

Command Objects are used to communicate with databases. The command object holds the sql query or stored procedure. Command objects travel over connections, and result sets are returned. These result sets are made available to the datareader or dataadapter objects.

The Data Adapter Object stores four command objects that are used to initialize and save the tables that the data set uses. The four command objects are updatecommand, insertcommand, delete command, and select command.

Data view object provides a custom view of a data table. It is equivalent to the ADO recordset because it contains a single view on top of the table data. A dataview object is useful for filtering and sorting a dataset. It enables you to view all or a subset of a data table.

A Data Reader object provides a readonly/forwardonly view of the data. It enables you to loop through records. For exaple, you can use it to show the results of a search on a web page. After you run a command, the resulting rowset can be passed to a datareader object, which allows you to view the resulting data.

The Data Set is the primary object in ado.net. it enables disconnected access to data allowing you to make an in-memory copy of the data store. This reduces the amount of time users are connected to the data store, ensuring maximum availability to all users.

The Data Adapter object acts as a mediator between the dataset and the data store. By using updatecommand, any modifications made to the dataset can be updated to the data store.

The data reader is less flexible than the data set because users much be connected to the data store at all times so they can use the information. However, the data reader is useful when accessing large amounts of data that may not fit into a data set.

By using the dataset technique, a user requests data from a data store and the data adapter retrieves the data from the data store. This information is then sent to a data table within the data set.

Next, the link that connected the data store to the dataset is cut. This enables disconnected access to the dataset. Finally, a data view is created and a list bound control is displayed.

The data reader technique does not allow disconnected access to the data store. When a user requests data, the command retrieve data from the data store into the data reader. However, the data reader is a read-only, forward-only stream of information returned from the database.

Difference between ADO and ADO.NET

ADO.NET offers much more flexibility and usability than ado. In ado, the recordset is used to represent database data. In ado.net, the dataset represent database data, in ADO.net, the dataset represents the database data. The dataset consists of a collection of tables with information on the relationships between those tables.

In ADO, a recordset resembles a single table. Using a join query, you can update it to consist of data from multiple database tables. In ado.net, a dataset consist of one or more tables. These tables are datatable objects. A dataset also contains a datarelation object representing the table relationships.

The dataset object ebables a client to work with data in a disconnected environment. You use a connection to connect to the data store. You use a command object to connect a dataadapter to the data source. Then, you fill dataset with the result.

In ado, you have a choice between using connected or disconnected options. For example, when using connected mode, you have the option of keeping the connection open after you have filled the recordset with data from the data store.

In ado.net, you use a connection to reconnect a dataadapter to the data source and you push the update back by using the UpdateCommand. In ADO, to update a disconnected recordset data source, you reconnect to the data source and use the update or updatebatch methods.

To transmit an ado recordset from one component to another, you use COM marshelling. To transmit an ado.net databset, you use an xml file.

ADO.NET

System.data The system.data namespace contains the basic objects that are used for accessing and storing relationship data. Tese objects include dataset, datatable and datarelation.

System.Data.Oledb This namespace contains the objects that are used to connect to a data source by using an OLE DB provider. These objects include oledbconnection and oledbcommand and are used for all databases except Microsoft sql server.

System.Data.SqlClient -- This namespace contains objects that are used to connect to a sql server data source. These objects include sql connection, are sql command. For communicating with a sql server database, these objects provide better performance than those objects in the system.data.oledb namespace.

Syste.Data.SqlTypes -- namespace contains classes to implement the data types generally found in relational databases such as sql server. These include sqlmoney, sqldatatime, and sql binary. These are beneficial because they improve performance and help to avoid type conversion errors.

System.xml --- the system.xml namespace contains the basic objects required to create, read, write, store, and manage xml documents according to w3c recommendations. It includes xmldocument and a series of objects, which represent the different types of node in an xml document.

Dim strConn =Provider=sqloledb.1; server=localhost;uid=sa;pwd=;database=catalog

Dim conn as new sqlconnection(strconn)

Non-sqlserver

Dim strconn as string=Provider=Microsoft.jet.4.0; data source=c:\catalog.mdb

Dim conn as new oledbconnection(strconn)

You use the DataAdapter object to copy data from the data store into the Dataset object. The DataAdapter object holds the command objects that are used to populate the dataset. The fill method of the DataAdapter is used to fill the dataset with results from a particular query.

The fill method of the dataadapter takes two parameters: an instance of a dataset object, and a string. The dataset instance represents the dataset to be filled, and the string identifies the table that will be created within the dataset. You can use this string to reference the datatable after it is created.

Objdataadapter.fill(objdatastore,tableidentifier)

Example:

Dim conn as new sqlconnection(server=localhost;uid=sa;pwd=;database=pubs)

Dim dbauthors as new sqldataAdapter(Select * from Authors, conn)

Dim dsBooks as new DataSet()

daAuthors.Fill(dsBooks,Authors)

Multiple Tables: Retrieving:

Dim objConnection as new oledbconnection(strconnection)

Dim objCommand as new oledbcommand()

Objcommand.connection = objConnection

Objcommand.commandtype=commandtype.text

Objcommand.commandtext = strselectbooks

Dim objDataAdapter as new oledbdataAdapter()

objDataAdapter.SelectCommand = objCommand

Dim objDataset as new Dataset()

objDataAdapter.Fill(objDataSet,Books)

objCommand.CommandText=strSelect2

ObjDataAdapter.Fill(objDataSet,Authors)

ObjConnect.Open()

Objconnect.Close()

If you are filling multiple tables, it is more efficient to open and close the connection manually before the first and last call to the fill method.

DataView:

The Dataview object of ASP.NET enables you to customize views on a datatable in a dataset. For example, you may decide to view all the table contents or just specific rows in it. In this topic, you learn about the functions of the dataview object.

Dim DV as new dataview(objdataset.tables(Authors))

The dataset can hold several datatables. A dataview does not refer to all the data in the dataset. It refers only to the portion of one of the tables that is used. The code presented on the screen describes the method to retrieve information on authors who live in CA.

Dim DV as new dataview(objdataset.tables(Authors))

DV.RowFilter = State=CA sort also possible DV.Sort = State

You can add rows to the dataview using the AddNew method, and then you can populate the new row. The code presented on the screen displays the new row with the added value Smith

Dim dv as new dataview(objdataset.tables(Authors))

Dim drv as datarowview

Drv = dv.addnew

Drv.beginedit()

Drv(Author)=Smith

Drv.endedit()

Delete the row also in DataView:

Dim dv as new DataView(objDataSet.Tables(Authors))

dv.Delete(i)

Templates:

Templates allow you to customize the colors, appearance and elements that are presented by certain asp.net controls. Both repreater and datalist controls accept a series of templates that define the layout and the output content.

Header Template: This template renders elements once before any data-bound rows have been rendered. It is often used to begin a container element, such as a table.

Item Template: The Item template is used once for each row in the data source to render elements. You need to declare at least one web control and set its data-binding expression to evaluate to a field in the data source of the control.

AlternativeItem Template: This template renders elements for every other row in the repeater control.

SelectedItem Template: This template is used to display the row in a datalist control, which has been selected.

Separator Template: This template is used to render elements between rows, such as line break tags
or line tags .

EditItem Template: This template is used to render a row for a datalist that allows the user to edit the data in that row. You can change form labels to input controls.

Footer Template: This template renders elements after all the data-bound rows have been rendered. It can be used to close an elelment that was opened in the header template item, such as an opening table tag.

Data Store ---(DataAdapter(DataSet(DataView(DataGrid

To use DataGrid control we must use line.

dgProducts.DataSource = ds dgProducts.DataSource=ds.Tables(Products)

dgProducts.DataBind()

using view to connect with datagrid

Dim dv as new dataview(ds.tables(Authors))

dv.rowfilter=state=VA

dgAuthors.DataSource=DV

dgAuthors.DataBind()

Repeater Controls:

The Repeater Control enables you to render data in a data-bound list. The Repeater Control doesnt have a built-in layout or style. You need to define the HTML layout, formatting, and style tag within the template of the control.

The Repeater control doesnt have formatting support. To display the data, you need to bind the data in the repeater control to templates. For example, to display a list of authors last names you use the code


Alternative Item Templates: (Example)

Calling Stored procedure:

Conn=new sqlconnection(strconnect)

Dim cmd as SqlDataAdapter

Cmd= new sqlDataAdapter()

cmd.SelectCommand = New SqlCommand()

With cmd.SelectCommand

.Connection= conn

.CommandText=ProductCatagoryList --- stored procedure name

.CommandType = CommandType.StoredProcedure

end With

=========================

Dim workparam as sqlparameter

Workparam = new sqlparameter(@CatagoryId, sqldbtype.int)

Workparam.direction = parameterdirection.input

Workparam.value = cint(txtcatid.text)

cmd.selectcommand.parameters.add(workparam)

=========================

Dim ds as DataSet

Ds = new DataSet()

cmd.Fill(ds,Categories)

Action Stored Procedure:

An Action stored procedure is used to call a stored procedure that does not return a set of records. It can be an update, insert, delete, or select stored procedure.

Procedure OrderCount(@CustomerID int, @itemcount int OUTPUT) AS

Select @ItemCount=Count(OrderId) from Orders where CustomerID=@customerID

Dim mycmd as SqlCommand=New SqlCommand(OrderCount, conn)

Mycmd.commandType = commandType.StoredProcedure

Dim workparam as SqlParameter

Workparam=new sqlparameter(@Customerid, sqldbtype.int)

Workparam.direction = parameterdirection.Input

Workparam.value=cint(txtcustid.text)

Mycmd.parameter.add(workparam)

Workparam=new sqlparameter(@itemcount,sqldatatype.int)

Workparam.Direction = parameterDirection.Output

Mycmd.Parameters.Add(workparam)

Conn.open()

Mycmd.ExecuteNonQuery()

Conn.close()

curSales = mycmd.Parameters(@ItemCount).Value

DataReader: Solve the problems that arise when a large amount of data is being retrieved. To overcome large amount of records such a situation, the data reader produces a read-only, forward-only stream returned from the database. Only one record is in the memory at any time.

SQLDataReader and OledbReader

Dim Conn As SqlConnection

Conn = New Sqlconnection(server=localhost;uid=sa;pwd=;database=pubs)

Conn.open

Dim CmdAuthors As sqlcommand = New sqlcommand(Select * from Authors, Conn)

Dim dr as SqlDataReader

dr = cmdAuthors.ExecuteReader()

dr.close

conn.close

to read the DataReader use the myreader.Read()

myreader.Read()

while myreader.Read()

end while

myreader.close()

Flow of DataReader:

Create a database connection ( open the database connection ( store query in command(Populate datareader with executereader ( Call Read for each record, and get for each field (Manually display(close the data readerconnection

Create a database connection ( store query in dataadapter ( fill dataset with fill method ( create dataview ( bind dataview to list-bound control

XML Reading into a Dataset

Reading XML data into a Dataset involves three stages. First, the XML file is read. Then, the contents of the FileStream are read. Finally, the data from the streamreader is read into a dataset. All of these steps are coded in the page_load event procedure, in the script section of the aspx file.

XML file is read, Contents of the FileStream are read, Data from the StreamReader is read.

Fs= new FileStream(server.mapPath(table.XML)

FileMode.Open, FileAccess.Read)

Reader = New StreamReader(fs)

Ds.REadxml(Reader)

XML can only be read into a DataSet. Reading XML data into DataSet involves three stages. Each of these stage use different syntax.

Side-by-side execution is the ability to run multiple versions of the same assembly simultaneously. The common language runtime provides the infrastructure that allows multiple versions of the same assembly to run on the same computer, or even in the same process.

Delegates

A delegate is a special class that represent a method signature.

1. Strongly typed( in other words, the method signature you define must be used exactly in all methods that will implement the delegate).

2. Delegates are used to implement callbacks and events in VB.NET.

How to use Delegate?

a. Define a delegate

b. You create an instance of the delegate

c. You use the AddressOf to get a reference to a real procedure, and store it in the delegate instance.

d. When the instance is invoked, its actually the procedure that is run, using any parameters that are passed into the delegate instance.

e. The delegate instance can be re-assigned to refer to a different procedure if desired.

f. Delegate can have any number of parameters or any allowable type.

g. Delegate can be defined wherever a class can

h. Delegate can return any allowable type

Multicast Delegates:

a. The magic of delegates--- linking multiple delegate instances together(multicasting).

b. You can add delegate instances 1.using the combine method

c. Or remove delegate instances 1.Using the Remove method.

d. Important: Only the last executed method returns a value.

Async delegates: Each delegate instance could be spun off on its own thread(Asynchronous Multicast Delegate) to perform in an asynchronous manner. Prevents blocking on long-running callbacks.

C# Reference

Introduction

(1) Device the dependent [ ppc, mobile]

(2) XML is backbone [Interoperability]

(3) Language Independancy

(4) Cross Language(Inheritance)

(5) Multipurpose Language

Framework:

(1) Web Services

(2) Utilities which controls registry

CLS - Common Language Specification

CTS - Common Type Specification

CLR - Common Language Runtime

MSIL MS Intermediate Language

Boxing, UnBoxing:

Converting simple type to object type. Used for passing parameters some methods.

Delegates: Address of method. One delegate possible to refer many methods or container of methods.

Event Creation:

Delegates are the backbone for events

Declaration of delegates

Creation of methods

Declaration of events (same delegate types)

Hooking an event

Invoking the event

Unhooking the event

Holding the method in the Delegate reference.

Property: Indirect access of a data member

Indexes: []

Properties: Indirectly access of a data member so it hides the public member also into a block unless we know the block name we cant access the member.

Static: Methods refers class reference. Non-Static: Requires object reference (It means we need to create object reference).

File Handling:

System.IO, Class Info, File, Directory Stream Reader, Stream Writer

Virtual: We can define function & method and definitions. Cant be empty

Abstract: We can create only Class Name. It should be place inside of abstract class.

Base: Base method used access base virtual method from derived method. We can use virtual function without use base using object instance method.

Pointer: Proceed with UnSafe.

What is com+ and what is difference between com and com+?

COM: The specification of standard functions that every supporting program should support.Each COM-compliant program has a few functions that enable another COM-compliant application to use it.COM+: The integration of MTS and DCOM.DCOM: Distributed-COM. The protocol that enables a COM object to be instantiated on another computer from the one that is using the code (ie. call from a client machine in London, but the code runs on the machine in New York).MTS: Microsoft Transaction Server. How MS coordinate a transaction across multiple servers. Specifically for multi-step operations that require the system to either work 100% or to revert back to a state before the transaction was started.

I hope this helps, these are the dictionary-definitions (sort-of) and should give you a good starting-point for delving into this area in more detail.

Overloads

Optional. Indicates that this Sub procedure overloads one or more procedures defined with the same name in a base class. The argument list in this declaration must be different from the argument list of every overloaded procedure. The lists must differ in the number of arguments, their data types, or both. This allows the compiler to distinguish which version to use.

You do not have to use the Overloads keyword when you are defining multiple overloaded procedures in the same class. However, if you use Overloads in one of the declarations, you must use it in all of them.

You cannot specify both Overloads and Shadows in the same procedure declaration.

Overrides

Optional. Indicates that this Sub procedure overrides an identically named procedure in a base class. The number and data types of the arguments must exactly match those of the base class procedure.

Overridable

Optional. Indicates that this Sub procedure can be overridden by an identically named procedure in a derived class. Overridable is the default setting for a procedure that itself overrides a base class procedure.

NotOverridable

Optional. Indicates that this Sub procedure cannot be overridden in a derived class. NotOverridable is the default setting for a procedure that does not itself override a base class procedure.

MustOverride

Optional. Indicates that this Sub procedure is not implemented in this class and must be implemented in a derived class for that class to be creatable.

Shadows

Optional. Indicates that this Sub procedure shadows an identically named programming element, or set of overloaded elements, in a base class. You can shadow any kind of declared element with any other kind. If you shadow a procedure with another procedure, the arguments and the return type do not have to match those in the base class procedure. A shadowed element is unavailable in the derived class that shadows it.

You cannot specify both Overloads and Shadows in the same procedure declaration.

Shared

Optional. Indicates that this Sub procedure is a shared procedure. This means it is not associated with a specific instance of a class or structure. You can call a shared procedure by qualifying it either with the class or structure name, or with the variable name of a specific instance of the class or structure.

Public

Optional. Procedures declared with the Public keyword have public access. There are no restrictions on the accessibility of public procedures.

Protected

Optional. Procedures declared with the Protected keyword have protected access. They are accessible only from within their own class or from a derived class. Protected access can be specified only on members of classes. It is not a superset of friend access.

Friend

Optional. Procedures declared with the Friend keyword have friend access. They are accessible from within the program that contains their declaration and from anywhere else in the same assembly.

Protected Friend

Optional. Procedures declared with the Protected Friend keywords have the union of protected and friend access. They can be used by code in the same assembly, as well as by code in derived classes. Protected friend access can be specified only on members of classes.

Private

Optional. Procedures declared with the Private keyword have private access. They are accessible only from within their declaration context, including from members of any nested types such as procedures.

name

Required. Name of the Sub procedure. Must be a valid Visual Basic identifier.

arglist

Optional. List of variables or expressions representing arguments that are passed to the Sub procedure when it is called. Multiple arguments are separated by commas. If you supply an argument list, you must enclose it in parentheses.

Implements

Optional. Indicates that this Sub procedure implements a Sub procedure defined by an interface.

interface

Required if Implements is supplied. The interface implemented by the class or structure containing this Sub procedure. The class or structure must specify interface in an Implements statement immediately following the Class or Structure statement.

definedname

Required if Implements is supplied. The name by which the Sub procedure is defined in interface. The name of this Sub procedure (in name) does not have to be the same as definedname.

statements

Optional. A block of statements to be executed within the Sub procedure.

End Sub

Terminates the definition of this Sub procedure.

Each argument in the arglist part has the following syntax and parts:UML Reference:

Life Cycle Models: Waterfall software lifecycle model: The waterfall method is probably the most commonly used lifecycle approach, because it is the closest to common sense-it comes more naturally to people than the other two approaches.

Analysis---(Design --( Implementation

Spiral software lifecycle model: The spiral process starts with analysis, containues with design, follows up with implementation, and then repeats itself by returning to the analysis phase. This method allows the development team to progressively complete a project.

Analysis(Design-(Implementation (Analysis--(Design-( Implementation

Iterative Software lifecycle model: This approach divides a project into subprojects, and allows you to perform the waterfall method on each. Instead of completing functionality in the entire application with each pass, as with the iterative method, the iterative-incremental method completes components based upon functionality with each phase.

Unified Process:

Inception: Identify the system you are going to develop, including what it contains and its business case.

Elaboration: Perform detailed design and identify the foundation of your system.

Construction: Write the Software.

Transition: Deliver the system to the user-sometimes better known as rolling out the system.

UML : Unified Modeling Language: Structural diagrams and Behavioral Diagrams.

Structural Diagrams: Class Diagrams and Implementation Diagrams.

Class Diagram and Object Diagram: A Class Diagram is used to represent the different underlying pieces(Classes), their relationship to each other, and which subsystem they belong to. Class diagrams include attributes and operations and well as many types of roles and associations.

An Object diagram is very similar to a class diagram, except instead of dealing with classes, it shows objects that are instances of classes. These diagrams are usually more about design by example. In other words, objects deal with individual unique things, whereas classes are more generic.

Behavioural Diagrams: Behavioural diagrams are used to show how process flows between components, classes, users and system. There are five behavioral diagrams belonging to UML. Use case diagram, Activity Diagram, Sequence Diagram, collabration Diagram and Statechart Diagram.