Click here to Skip to main content
12,446,146 members (78,033 online)
Click here to Skip to main content
Articles » Database » Database » General » Downloads

Stats

144.2K views
3.6K downloads
75 bookmarked
Posted

Databinding the SqlTypes

, 1 May 2003
Databinding the SqlTypes using the PropertyDescriptor class and the ITypedList Interface
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

You may also be interested in...

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