Friday, September 11, 2015

Retrieving Records That Contain Values in a Given Range

Retrieving Records That Contain Values in a Given Range

 Range operators retrieve data based on a range. The syntax for using range operators in the SELECT statement is: SELECT column_list FROM table_name WHERE expression1 range_operator expression2 AND expression3 where, expression1 , expression2 , and expression3 are any valid combination of constants, variables, functions, or column
-
based expressions. range_operator is any valid range operator. Range operators are of the following types:


BETWEEN : 

Specifies an inclusive range to search. The following SQL query retrieves records from the Employee table where the number of hours that the employees can avail to go on a vacation is between 20 and 50: SELECT EmployeeID, VacationHours FROM HumanResources.Employee WHERE VacationHours BETWEEN 20 AND 50

NOT BETWEEN : 

Excludes the specified range from the result set. The following SQL query retrieves records from the Employee table where the number of hours that the employees can avail to go on a vacation is not between 40 and 50: SELECT EmployeeID,VacationHours FROM HumanResources.Employee WHERE VacationHours NOT BETWEEN 40 AND 50

Retrieving Records That Match One or More Conditions

Retrieving Records That Match One or More Conditions 

Logical operators are used in the SELECT statement to retrieve records based on one or more conditions. While querying data, you can combine more than one logical operator to apply multiple search conditions. In a SELECT statement, the conditions specified in the WHERE clause are connected by using the logical operators.
The syntax for using logical operators in the SELECT statement is:
 SELECT column_list FROM table_name WHERE conditional_expression1 {AND/OR} [NOT] conditional_expression2 where, conditional_expression1 and conditional_expression2 are any conditional expressions.

The three types of logical operators are:




OR : 

Returns a true value when at least one condition is satisfied. For example, the following SQL query retrieves records from the Department table when the GroupName is either Manufacturing or Quality Assurance: SELECT * FROM HumanResources.Department WHERE GroupName = ‘Manufacturing’ OR GroupName = ‘Quality Assurance’

 AND :

 Is used to join two conditions and returns a true value when both the conditions are satisfied. To view the details of all the employees of AdventureWorks who are married and working as a Production Technician
-
WC60, you can use the AND logical operator, as shown in the following query: SELECT * FROM HumanResources.Employee WHERE Title = ‘Production Technician - WC60’ AND MaritalStatus = ‘M’

NOT :

 Reverses the result of the search condition. The following SQL query retrieves records from the Department table when the GroupName is not Quality Assurance: SELECT * FROM HumanResources.Department WHERE NOT GroupName = ‘Quality Assurance’ The preceding query retrieves all the rows except the rows that match the condition specified after the NOT conditional expression.

TYPE OF DELEGATES

Delegates are of two types and depending upon the requirement of the application, the suitable type of delegate is selected. The two types of delegates are:

  1.  Single-cast delegate 
  2. Multicast delegate

 A single-cast delegate can call only one method at a time, whereas a multicast delegate can call multiple methods at the same time.

Single-cast Delegate 

A single-cast delegate derives from the System.Delegate class. It contains reference to only one method at a time. In the preceding code, the delegate used is a single-cast delegate. The WriteConsole() and WriteFile() methods are being referenced by the delegate, PrintData, one after the other at run time. Consider the coffee vending machine example. To provide black coffee, a delegate that holds reference to the methods to dispense hot water and coffee powder is used. The reference to these methods is made dynamically, but one after the other. This means coffee powder and hot water will be dispensed from the machine one after the other.

Multicast Delegate 

A multicast delegate derives from the System.MulticastDelegate class. It contains an invocation list of multiple methods. In multicasting, you create a single delegate that invokes multiple encapsulated methods. Consider the coffee vending machine example. You are dispensing black coffee, which in turn calls the methods to dispense hot water and coffee powder. If you want the methods to dispense hot water and coffee powder to be called at the same time, you can make use of a multicast
delegate.

DELEGATES

DELEGATES

C# delegates are similar to pointers to functions, in C or C++.
 A delegate is a reference type variable that holds the reference to a method. The reference can be changed at runtime. Delegates are especially used for implementing events and the call-back methods. All delegates are implicitly derived from the System.Delegate class. 

For example, consider a delegate: 
public delegate int MyDelegate (string s); 
The preceding delegate can be used to reference any method that has a single stringparameter and returns an int type variable.
Syntax for delegate declaration is: 
delegate <return type> <delegate-name> <parameter list>



Monday, September 7, 2015

html5

To create a form on a Web page, you need to use the <FORM> tag.
The <FORM> tag supports the following attributes:

  • name 
  • ID 
  • action
  •  method
  •  autocomplete 
  • novalidate
  •  target 

The fields can be added to a form by using the following tags:

  •     <INPUT>
  •  <SELECT>
  •  <LABEL> 
  • <FIELDSET>
  •  <TEXTAREA>
  •  <DATALIST> 
  • <KEYGEN> 
  • <OUTPUT> 
  • <BUTTON> 

JavaScript defines the following browser objects on a Web page:


  •  window
  •  document
  •  navigator 
  • screen 
  • history
  •  location

 Browser objects represent the browser environment and provide properties and methods for its access and manipulation
. The form object is a browser object, which acts as a container for several other objects that collect information from a user.
The following objects of JavaScript are commonly used while working with Web forms:

  •  form 
  • button
  •  checkbox
  •  text
  •  textarea
  •  radio 
  • select