public void AddColumn()
        {
            Employees emps = new Employees();

            if (emps.LoadAll())
            {
                DataColumn col = emps.AddColumn("FullName", Type.GetType("System.String"));
                col.Expression = Employees.ColumnNames.LastName + "+ ', ' + " + Employees.ColumnNames.FirstName;

                string fullName;

                do
                {
                    fullName = emps.GetColumn("FullName") as string;
                }while(emps.MoveNext());
            }

            //-----------------------------------------------------------
            // Moral:
            //-----------------------------------------------------------
            // Of course if( you add a column Dynamically as the code does above
            // you'll have no strongly typed accessor like emps.FullName, but you
            // can use GetColumn() to access dynamic columns.
            //
            // Never use this to access other fields in your business entity
            // although it may work, it's poor programming and always use
            // your ColumnNames property and not hardcoded strings when possible
            //-----------------------------------------------------------
        }
		public void SimpleLoad()
		{
			// LoadAll() expects a stored proc to exist in your database
			Employees emps = new Employees();
			if(emps.LoadAll())   // [proc_EmployeesLoadAll]
			{
				// At least one row was loaded
			}

			// LoadAll is the same as (but maybe less efficient) than this
			emps = new Employees();
			if(emps.Query.Load()) // SELECT * FROM Employees
			{
				// At least one row was loaded
			}

			//-----------------------------------------------------------
			// Moral: 
			//-----------------------------------------------------------
			// LoadAll() and Query.Load() with no Where clause yield the same results
			// however, Query.Load() builds dynamic SQL, all query data is passed
			// in via SqlParameters so there is no chance for hackers to attempt
			// "sql injection" techniques
			//-----------------------------------------------------------
		}
        public void FilterAndSort()
        {
            Employees emps = new Employees();

            if (emps.LoadAll())
            {
                // After you load your business entity you can apply Sort and Filter,
                // you could also potentially do this in the Where clause too
                emps.Filter = Employees.ColumnNames.City + " = 'Berlin'";
                emps.Sort   = Employees.ColumnNames.LastName + " DESC";

                // Filter might have "hidden" all of the rows
                if (emps.RowCount > 0)
                {
                    string lastName;

                    // Remember, iteration walks the DataTable.DefaultView which is
                    // effected by Sort and Filter, so you'll only get Employees who
                    // live in Berlin, and they'll fed to your MoveNext() loop in decending
                    // order by LastName
                    do
                    {
                        lastName = emps.LastName;
                    }while(emps.MoveNext());
                }

                //-----------------------------------------------------------
                // Moral:
                //-----------------------------------------------------------
                // Sort and Filter can be great ways to implement data grid
                // filtering in your user interface when you don't want to requery
                // the database, just bind your grid to emps.DefaultView
                //-----------------------------------------------------------
            }
        }
        public void SimpleLoad()
        {
            // LoadAll() expects a stored proc to exist in your database
            Employees emps = new Employees();

            if (emps.LoadAll())              // [proc_EmployeesLoadAll]
            {
                // At least one row was loaded
            }

            // LoadAll is the same as (but maybe less efficient) than this
            emps = new Employees();
            if (emps.Query.Load())            // SELECT * FROM Employees
            {
                // At least one row was loaded
            }

            //-----------------------------------------------------------
            // Moral:
            //-----------------------------------------------------------
            // LoadAll() and Query.Load() with no Where clause yield the same results
            // however, Query.Load() builds dynamic SQL, all query data is passed
            // in via SqlParameters so there is no chance for hackers to attempt
            // "sql injection" techniques
            //-----------------------------------------------------------
        }
        public void Iteration()
        {
            Employees emps = new Employees();

            if (emps.LoadAll())
            {
                string lastName;

                // Iteration walks the DataTable.DefaultView, see the FilterAndSort
                // sample for further clarification.
                do
                {
                    lastName = emps.LastName;
                }while(emps.MoveNext());

                emps.Rewind();

                do
                {
                    lastName = emps.LastName;
                }while(emps.MoveNext());
            }

            //-----------------------------------------------------------
            // Moral:
            //-----------------------------------------------------------
            // Iteration is simple, you can rewind and restart at any time
            //-----------------------------------------------------------
        }
        public void DataSetSerialize()
        {
            Employees emps = new Employees();

            emps.LoadAll();                            // emps.RowCount = 200
            emps.LastName = "Griffinski";              // Change first row
            emps.GetChanges();                         // emps.RowCount now = 1
            string str = emps.Serialize();

            // Now reload that single record into a new Employees object and Save it
            Employees empsClone = new Employees();

            empsClone.Deserialize(str);
            empsClone.Save();
        }
        public void DemonstrateBulkUpdates()
        {
            Employees emps = new Employees();

            if (emps.LoadAll())
            {
                // Modify the LastName column in every row
                do
                {
                    emps.LastName += "W";
                }while(emps.MoveNext());
            }

            // Rewind and mark the first row as Deleted
            //emps.Rewind();
            //emps.MarkAsDeleted();

            // Add a new row and fill it in
            emps.AddNew();
            emps.FirstName = "Jimmy";
            emps.LastName  = "Lunch Box";

            // Save all modifications, deletes, and new rows
            emps.Save();

            //-----------------------------------------------------------
            // Moral:
            //-----------------------------------------------------------
            // This is a very nice way to work. When you generate your
            // stored procedures using 'SQL_StoredProcs.vbgen' you'll find
            // it is pretty smart. It makes any identity columns
            // and or computed columns as OUTPUT parameters. Thus, after Save()
            // any new rows or updated rows have their identity
            // columns or calulated columns already in them, no
            // requerying the database
            //
            // You never have to use a transaction when saving a single object.
            // The dOOdad architecture always does this for you.
            //-----------------------------------------------------------
        }
        public void Serialize()
        {
            Employees emps = new Employees();

            emps.LoadAll();                            // emps.RowCount = 200
            emps.LastName = "Griffinski";              // Change first row
            emps.GetChanges();                         // emps.RowCount now = 1
            string str = emps.ToXml();

            // Now reload that single record into a new Employees object and Save it
            Employees empsClone = new Employees();

            empsClone.FromXml(str);
            empsClone.Save();

            //-----------------------------------------------------------
            // Moral:
            //-----------------------------------------------------------
            // This really only serializes the data in the embedded DataTable.
            // However, the methods used in the sample above our virtual
            // so you can override them.
            //-----------------------------------------------------------
        }
		public void DataSetSerialize()
		{
			Employees emps = new Employees();
			emps.LoadAll();                // emps.RowCount = 200
			emps.LastName = "Griffinski";  // Change first row
			emps.GetChanges();             // emps.RowCount now = 1 
			string str = emps.Serialize(); 
            
			// Now reload that single record into a new Employees object and Save it
			Employees empsClone = new Employees();
			empsClone.Deserialize(str);
			empsClone.Save();
		}
		public void Serialize()
		{
			Employees emps = new Employees();
			emps.LoadAll();                // emps.RowCount = 200
			emps.LastName = "Griffinski";  // Change first row
			emps.GetChanges();             // emps.RowCount now = 1 
			string str = emps.ToXml();
            
			// Now reload that single record into a new Employees object and Save it
			Employees empsClone = new Employees();
			empsClone.FromXml(str);
			empsClone.Save();

			//-----------------------------------------------------------
			// Moral: 
			//-----------------------------------------------------------
			// This really only serializes the data in the embedded DataTable.
			// However, the methods used in the sample above our virtual
			// so you can override them.
			//-----------------------------------------------------------
		}
		public void AddColumn()
		{
			Employees emps = new Employees();
			if(emps.LoadAll())
			{
				DataColumn col = emps.AddColumn("FullName", Type.GetType("System.String"));
				col.Expression = Employees.ColumnNames.LastName + "+ ', ' + " + Employees.ColumnNames.FirstName;

				string fullName;

				do
					fullName = emps.GetColumn("FullName") as string;
				while(emps.MoveNext());
			}

			//-----------------------------------------------------------
			// Moral: 
			//-----------------------------------------------------------
			// Of course if( you add a column Dynamically as the code does above
			// you'll have no strongly typed accessor like emps.FullName, but you
			// can use GetColumn() to access dynamic columns.
			//
			// Never use this to access other fields in your business entity
			// although it may work, it's poor programming and always use
			// your ColumnNames property and not hardcoded strings when possible
			//-----------------------------------------------------------
		}
		public void DemonstrateBulkUpdates()
		{
			Employees emps = new Employees();
			if(emps.LoadAll())
			{
				// Modify the LastName column in every row
				do
					emps.LastName += "W";
				while(emps.MoveNext());
			}

			// Rewind and mark the first row as Deleted
			//emps.Rewind();
			//emps.MarkAsDeleted();

			// Add a new row and fill it in
			emps.AddNew();
			emps.FirstName = "Jimmy";
			emps.LastName = "Lunch Box";

			// Save all modifications, deletes, and new rows 
			emps.Save();

			//-----------------------------------------------------------
			// Moral: 
			//-----------------------------------------------------------
			// This is a very nice way to work. When you generate your
			// stored procedures using 'SQL_StoredProcs.vbgen' you'll find
			// it is pretty smart. It makes any identity columns
			// and or computed columns as OUTPUT parameters. Thus, after Save()
			// any new rows or updated rows have their identity
			// columns or calulated columns already in them, no
			// requerying the database
			// 
			// You never have to use a transaction when saving a single object.
			// The dOOdad architecture always does this for you.         
			//-----------------------------------------------------------
		}
		public void FilterAndSort()
		{
			Employees emps = new Employees();
			if(emps.LoadAll())
			{
				// After you load your business entity you can apply Sort and Filter,
				// you could also potentially do this in the Where clause too
				emps.Filter = Employees.ColumnNames.City + " = 'Berlin'";
				emps.Sort   = Employees.ColumnNames.LastName + " DESC";

				// Filter might have "hidden" all of the rows
				if(emps.RowCount > 0)
				{
					string lastName;

					// Remember, iteration walks the DataTable.DefaultView which is 
					// effected by Sort and Filter, so you'll only get Employees who
					// live in Berlin, and they'll fed to your MoveNext() loop in decending
					// order by LastName
					do
						lastName = emps.LastName;
					while(emps.MoveNext());
				}

				//-----------------------------------------------------------
				// Moral: 
				//-----------------------------------------------------------
				// Sort and Filter can be great ways to implement data grid
				// filtering in your user interface when you don't want to requery 
				// the database, just bind your grid to emps.DefaultView
				//-----------------------------------------------------------
			}
		}
		public void Iteration()
		{
			Employees emps = new Employees();
			if(emps.LoadAll())
			{
				string lastName;

				// Iteration walks the DataTable.DefaultView, see the FilterAndSort
				// sample for further clarification.
				do
					lastName = emps.LastName;
				while(emps.MoveNext());

				emps.Rewind();

				do
					lastName = emps.LastName;
				while(emps.MoveNext());
			}

			//-----------------------------------------------------------
			// Moral: 
			//-----------------------------------------------------------
			// Iteration is simple, you can rewind and restart at any time
			//-----------------------------------------------------------
		}