Dot Net Summary
Dot Net Summary
in
3. Metadata
Definition: Metadata is data about the code, such as definitions and references, stored within
assemblies.
Features:
Enables reflection (inspection of code at runtime).
Facilitates cross-language interoperability.
Summary Dot Net Programming mrsandy.in
4. .NET Namespaces
Definition: Namespaces in .NET organize classes and other data types for easier
management and avoidance of name conflicts.
Examples:
System : Core functionalities.
System.IO : File handling.
System.Net : Networking functionalities.
Usage:
using System;
using System.IO;
Enhanced scalability.
Rich set of controls for faster development.
Example:
3. Web Forms
Definition: Web Forms is a part of ASP.NET that simplifies the creation of dynamic, data-
driven web pages using event-driven programming.
Components:
Summary Dot Net Programming mrsandy.in
Pages: .aspx files that define the structure and layout of the web page.
Code-behind files: Contain the server-side logic in C# or VB.NET.
Features:
Supports drag-and-drop controls in Visual Studio.
Automatically generates client-side HTML and JavaScript.
Example:
4. Web Controls
Definition: Reusable UI components in ASP.NET for creating web pages.
Types:
Standard Controls: Basic controls like TextBox , Label , Button .
Data Controls: For displaying and managing data (e.g., GridView , Repeater ).
Navigation Controls: For menus and site navigation (e.g., Menu , TreeView ).
Validation Controls: To ensure proper user input (e.g., RequiredFieldValidator ).
Example:
Example:
Summary Dot Net Programming mrsandy.in
AdRotator:
Rotates ads based on an XML file or database.
Supports weighted rotation for better ad targeting.
Example:
FileUpload:
Allows users to upload files to the server.
Example:
Summary Dot Net Programming mrsandy.in
3. Validation Controls
Definition: Built-in controls to ensure that the data entered by the user is valid before
processing.
Common Validation Controls:
RequiredFieldValidator:
Ensures that a field is not empty.
Summary Dot Net Programming mrsandy.in
Example:
CompareValidator:
Compares the value of one control to another or a specific value.
Example:
RangeValidator:
Ensures that input falls within a specific range.
RegularExpressionValidator:
Validates input using a regular expression.
Example:
4. Debugging
Definition: The process of identifying and resolving errors or bugs in an application.
Tools for Debugging:
Visual Studio Debugger:
Set breakpoints to pause execution and inspect variable values.
Summary Dot Net Programming mrsandy.in
Trace.WriteLine("Page Loaded");
Best Practices:
Use meaningful variable names.
Keep breakpoints only during debugging.
Test edge cases thoroughly.
UNIT-IV: ADO.NET
1. Basics of ADO.NET
Definition: ADO.NET is a data access technology in the .NET framework that facilitates
communication between applications and data sources like SQL Server or Oracle.
Features:
Disconnected Data Access: Works with in-memory data structures like DataSet .
Integration with XML: Supports operations on XML data.
Optimized Providers: Includes providers like SQL Server and OLEDB for efficient
database access.
2. ADO.NET Objects
2.1 Data Table
Definition: Represents a table of in-memory data with rows and columns.
Features:
Contains schema information and data.
Can be used independently or within a DataSet .
2.2 Data View
Definition: Provides a customizable and filterable view of a DataTable .
Usage:
Sort or filter rows without modifying the underlying DataTable .
2.3 Data Set
Definition: An in-memory representation of a collection of related tables and relationships.
Features:
Supports disconnected operations.
Can work with multiple tables simultaneously.
2.4 Data Adapter
Definition: Acts as a bridge between a database and a DataSet .
Usage:
Summary Dot Net Programming mrsandy.in
Fills the DataSet with data and updates the database with changes.
Fetching Data:
using (SqlConnection conn = new SqlConnection("Connection_String"))
{
string query = "SELECT * FROM Employees";
SqlDataAdapter adapter = new SqlDataAdapter(query, conn);
DataSet ds = new DataSet();
adapter.Fill(ds, "Employees");
foreach (DataRow row in ds.Tables["Employees"].Rows)
{
Console.WriteLine(row["Name"]);
}
}
Updating Data:
using (SqlConnection conn = new SqlConnection("Connection_String"))
{
string query = "UPDATE Employees SET Name = 'John' WHERE Id = 1";
SqlCommand cmd = new SqlCommand(query, conn);
conn.Open();
cmd.ExecuteNonQuery();
}