1. Add a table named MyImages to your SQL Server Northwind database. Include the following fields in your table:
* Identity field that is named "ID" of type Int.
* Field that is named "Description" of type VarChar with a length of 50.
* Field that is named "ImgField" of type Image.
2. Start Visual Studio .NET, and then create a new Visual C# Windows Application project.
3. Drag two Button controls from the toolbox to the default form, Form1.
4. In the Properties window, change the Text property of Button1 to Save to Database (from File), and then change the Text property of Button2 to Save to File (from Database).
5. Add the following code to the top of the Code window:
using System.Data;
using System.Data.SqlClient;
using System.IO;
Sunday, April 11, 2010
Use of Exception Handling
Using Exception Handling
using System;
using System.Collections;
class ExceptionsSample
{
static void Main( string[] args )
{
try
{
// Create a container to hold employees
Employees employees = new Employees(4);
// Add some employees
addOneEmployee ( employees, "Timothy", "Arthur",
"Tucker", "555-55-5555" );
addOneEmployee ( employees, "Sally", "Bess",
"Jones", null );
addOneEmployee ( employees, "Jeff", "Michael",
"Simms", "777-77-7777" );
addOneEmployee ( employees, "Janice", "Anne",
"Best", "9888-88-88889" );
// Display the employee list on screen
foreach ( Employee employee in employees )
{
string name = employee.FirstName + " " +
employee.MiddleName + " " + employee.LastName;
string ssn = employee.SSN;
Console.WriteLine( "Name: {0}, SSN: {1}", name, ssn );
}
}
catch ( Exception exception )
{
// Display any errors on screen
Console.WriteLine( exception.Message );
}
}
// Helper method to add an employee to the list
static void addOneEmployee( Employees employees,
string FirstName, string MiddleName, string LastName,
string SSN )
{
bool addedEmployee = false;
try
{
Console.WriteLine( "Adding an employee" );
if ( SSN == null )
throw new ArgumentNullException( "SSN is null!" );
if ( SSN.Length != 11 )
throw new ArgumentOutOfRangeException(
"SSN length invalid!" );
using System;
using System.Collections;
class ExceptionsSample
{
static void Main( string[] args )
{
try
{
// Create a container to hold employees
Employees employees = new Employees(4);
// Add some employees
addOneEmployee ( employees, "Timothy", "Arthur",
"Tucker", "555-55-5555" );
addOneEmployee ( employees, "Sally", "Bess",
"Jones", null );
addOneEmployee ( employees, "Jeff", "Michael",
"Simms", "777-77-7777" );
addOneEmployee ( employees, "Janice", "Anne",
"Best", "9888-88-88889" );
// Display the employee list on screen
foreach ( Employee employee in employees )
{
string name = employee.FirstName + " " +
employee.MiddleName + " " + employee.LastName;
string ssn = employee.SSN;
Console.WriteLine( "Name: {0}, SSN: {1}", name, ssn );
}
}
catch ( Exception exception )
{
// Display any errors on screen
Console.WriteLine( exception.Message );
}
}
// Helper method to add an employee to the list
static void addOneEmployee( Employees employees,
string FirstName, string MiddleName, string LastName,
string SSN )
{
bool addedEmployee = false;
try
{
Console.WriteLine( "Adding an employee" );
if ( SSN == null )
throw new ArgumentNullException( "SSN is null!" );
if ( SSN.Length != 11 )
throw new ArgumentOutOfRangeException(
"SSN length invalid!" );
C# control Statement
Using the while Statement
The while statement is also used to loop through a series of statements until a test
Boolean expression evaluated at the beginning of the loop is false.The following
code has the same result as the previous for statement example:
int i = 0;
while ( i < 5 )
{
Console.WriteLine( "I will not talk in class" );
i++;
}
Using the do while Statement
The do while statement is also used to loop through a series of until a test
Boolean expression evaluated at the end of the loop is false.Therefore, the series
of statements contained within the do while loop will always execute at least once:
int i = 6;
do
{
Console.WriteLine( "I will not talk in class" );
i++;
}
while ( i < 5 );
Using the break Statement
The break statement exits the loop of a for, while, or do while statement regardless
of value of the test Boolean expression. In each of the following examples, the
WriteLine method will execute two times:
int j = 0;
for ( int i = 0; i < 5; i++ )
{
Console.WriteLine( "I will not talk in class" );
j++;
if ( j == 2 )
The while statement is also used to loop through a series of statements until a test
Boolean expression evaluated at the beginning of the loop is false.The following
code has the same result as the previous for statement example:
int i = 0;
while ( i < 5 )
{
Console.WriteLine( "I will not talk in class" );
i++;
}
Using the do while Statement
The do while statement is also used to loop through a series of until a test
Boolean expression evaluated at the end of the loop is false.Therefore, the series
of statements contained within the do while loop will always execute at least once:
int i = 6;
do
{
Console.WriteLine( "I will not talk in class" );
i++;
}
while ( i < 5 );
Using the break Statement
The break statement exits the loop of a for, while, or do while statement regardless
of value of the test Boolean expression. In each of the following examples, the
WriteLine method will execute two times:
int j = 0;
for ( int i = 0; i < 5; i++ )
{
Console.WriteLine( "I will not talk in class" );
j++;
if ( j == 2 )
Explaining Control Structures of C#
Using the if-else Statement
The if-else statement adds a path for the false evaluation of the Boolean expression.
int i = 3;
int j = 0;
int k = 0;
if ( i > 2 )
{
j = 3;
}
else
{
j = 4;
k = 5;
}
The if-else statement adds a path for the false evaluation of the Boolean expression.
int i = 3;
int j = 0;
int k = 0;
if ( i > 2 )
{
j = 3;
}
else
{
j = 4;
k = 5;
}
GridView with CheckBox for Deleteing the checked Items..
[asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"]
[Columns]
[asp:BoundField DataField="roll_no" HeaderText="Roll No" /]
[asp:BoundField DataField="s_name" HeaderText="Student Name" /]
[asp:BoundField DataField="class" HeaderText="Class" /]
[asp:TemplateField]
[ItemTemplate]
[asp:CheckBox ID="ch1" Text='<%# Eval("roll_no") %>' runat="server" /]
[/ItemTemplate]
[/asp:TemplateField]
[/Columns]
[/asp:GridView]
[Columns]
[asp:BoundField DataField="roll_no" HeaderText="Roll No" /]
[asp:BoundField DataField="s_name" HeaderText="Student Name" /]
[asp:BoundField DataField="class" HeaderText="Class" /]
[asp:TemplateField]
[ItemTemplate]
[asp:CheckBox ID="ch1" Text='<%# Eval("roll_no") %>' runat="server" /]
[/ItemTemplate]
[/asp:TemplateField]
[/Columns]
[/asp:GridView]
Saturday, April 10, 2010
GROUP FACE IDENTIFICATION BASED ON SKIN TONE AND DCTAPPROACH
A WINNER IN BA CKB ONE - D WDM TECHNOLOGY
First generation networks use copper-based or microwave technologies e.g.
Ethernet, satellites etc. In second generation networks, these copper links or
microwave links with opticalfibers. However; these networks still perform the
switching of data in the electronic domain though the transmission of data is
done in the optical domain. Finally we have the third generation networks that
employ Wavelength Division Multiplexing technology. They do both the
transmission and the switching of data in the optical domain. Ais has resulted
in the onset of tremendous amount of bandwidth availability. Dense Wavelength
Division Multiplexing (D WDM) is aft ber-optic transmission technique. It
involves the process ofmulliple.xing many different wavelength signals onto a
singlefIber. So eachfiber has a set of parallel optical channels each using
slightly d(fferent light wavelengths. This technicalpaper gives overview of the
advance technoloNy-D WDM used in optical networking It starts with the
introduction and required bandwidth criteria. It also discussedEvaluation in D
WDM,D WDM System Functions and some applications of D WDM
Subscribe to:
Posts (Atom)
-
In object-oriented languages the term "interface" is often used to define an abstract type that contains no data but exposes behav...
-
The following article discusses the WPF command binding feature with relation to Mouse clicks. One of WPF powerful features is the bindin...