Click here to Skip to main content
Click here to Skip to main content
Articles » Database » Database » General » Downloads
 
Add your own
alternative version

Databinding the SqlTypes

, 1 May 2003
Databinding the SqlTypes using the PropertyDescriptor class and the ITypedList Interface
itypedlistexample_demo.zip
ComplexDataBinding.exe
itypedlistexample_src.zip
ITypedListExample
ITypedList.csproj.user
using System;
using System.Data;

namespace ITypedListExample
{
	/// <summary>
	/// Summary description for FakeData.
	/// </summary>
	public class FakeData
	{
		private FakeData(){}

		public static MyCollection GetData()
		{
			MyCollection collection = new MyCollection();
			
			for ( int i = 0; i < 10; i++ )
			{
				MyCollection iCollection = new MyCollection();
				DataTable dt = GetDataTable();
				MyData ii = new MyData(dt.Rows[i]);
				
				
				ii.MyChildren = iCollection;
				collection.Add(ii);

				for ( int j = 0; j < 10; j++ )
				{
					MyCollection jCollection = new MyCollection();
					MyData jj = new MyData(dt.Rows[j]);
				
					jj.MyChildren = jCollection;
					iCollection.Add(jj);

					for ( int k = 0; k < 10; k++ )
					{
						MyCollection kCollection = new MyCollection();
						MyData kk = new MyData(dt.Rows[k]);
						jCollection.Add(kk);
					}
				}
			}
			return collection;
		}

		public static DataTable GetDataTable()
		{
			DataTable dt = new DataTable();

			dt.Columns.AddRange(new DataColumn[]{ new DataColumn("ID",typeof(int)), new DataColumn("dtStamp",typeof(DateTime)) } );

			for ( int j = 0; j < 10; j++ )
			{
				dt.Rows.Add(new object[]{j, DateTime.Now});
			}

			return dt;
		}
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Dan Glass
Architect support.com
Australia Australia

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.141216.1 | Last Updated 2 May 2003
Article Copyright 2003 by Dan Glass
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid