Wednesday, 22 June 2011

Hosting coupons

How to Create Read only comboBox in C#


When you  create read only comboBox then you use two Events 

  1. KeyPress
  2. KeyDown

1.KeyPress Event:-
                                 Keypress Event arguments handled property is true.this property to all keypress object is handled and event is fire to no argument is apply all is handled by e.
e is a object that handled events.


2.KeyDown:-
                        In KeyDown Events all object handled by e object like Ctrl + C ,key arrows,keysdata etc are handled to this event to read only comboBox in C# this cod is very useful to this problem.
------------------------------ See this source code----------------------------------

  private void comboBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            e.Handled = true;
           
        }


        private void comboBox1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyData == (Keys)Shortcut.CtrlC)
            {
                Clipboard.SetData(DataFormats.Text, comboBox1.SelectedText);
            }
            else if (e.KeyData == Keys.Left || e.KeyData == Keys.Right || e.KeyData == Keys.Up || e.KeyData == Keys.Down) { }
            else
            {
                e.Handled = true;
            }
        }

Thursday, 16 June 2011

How to compare two tables - SQL Server

Sample SQL statements to compare data in two tables with identical structure.
(Statements work for MS SQL Server, as well as for many other databases.)
To find records which exist in source table but not in target table:
SELECT * FROM t1 WHERE NOT EXISTS (SELECT * FROM t2 WHERE t2.Id = t1.Id)
or
SELECT * FROM t1 LEFT OUTER JOIN T2 on t1.Id = t2.Id WHERE t2.Id IS NULL
If the primary key consists of more than one column, you can modify SQL statement:
SELECT Id, Col1 FROM t1 WHERE NOT EXISTS
(SELECT 1 FROM t2 WHERE t1.Id = t2.Id AND Col1.t1 = Col2.t2)
On SQL Server 2005 or newer you can use the EXCEPT operator:
SELECT Id, Col1 FROM t1 EXCEPT SELECT Id, Col1 FROM t2
To find records which exist in source table but not in target table,
 as well as records which exists in target table but not in source table:
SELECT * FROM (SELECT Id, Col1 FROM t1, 'old'
UNION ALL
SELECT Id, Col1 FROM t2, 'new') t
ORDER BY Id
Note: For tables with large amounts of data UNION statement might be very slow. 

Friday, 10 June 2011

Software development objective

The aim of software engineering is to find methods for developing high quality software products at a reasonable cost. As more and more computers are being used in areas in which a malfunction of the system can be a source of serious losses or disturbances to the functioning of the society, the quality of software becomes a more and more critical factor of business success, human security, and safety. Examples of such application areas are enterprise management, public administration, and social insurance or post delivery services. The quality of services offered to the society depends on the quality of software systems that support the functioning of the respective public or private organizations