Click here to Skip to main content
15,921,028 members
Home / Discussions / C#
   

C#

 
QuestionIs there a WndProc or windowMessage numberlist reference somehwhere on the net? Pin
FocusedWolf26-Sep-04 8:53
FocusedWolf26-Sep-04 8:53 
AnswerRe: Is there a WndProc or windowMessage numberlist reference somehwhere on the net? Pin
FocusedWolf26-Sep-04 9:14
FocusedWolf26-Sep-04 9:14 
AnswerRe: Is there a WndProc or windowMessage numberlist reference somehwhere on the net? Pin
Dave Kreskowiak27-Sep-04 4:05
mveDave Kreskowiak27-Sep-04 4:05 
GeneralDataTable question... Pin
Besinci26-Sep-04 7:18
Besinci26-Sep-04 7:18 
GeneralRe: DataTable question... Pin
Charlie Williams26-Sep-04 8:25
Charlie Williams26-Sep-04 8:25 
GeneralRe: DataTable question... Pin
Besinci26-Sep-04 9:58
Besinci26-Sep-04 9:58 
GeneralRe: DataTable question... Pin
Sendilkumar.M26-Sep-04 20:11
Sendilkumar.M26-Sep-04 20:11 
GeneralRe: DataTable question... Pin
Besinci28-Sep-04 8:05
Besinci28-Sep-04 8:05 
Hi SendilKumar Smile | :)

As you can see in the code, the properties 'Id' and 'Name' in Debtable class.. -I have the same problem with the property 'Columns' that is derived from the System.Data.DataTable
I have to use casting to System.Data.DataColumn

If you can solve this issue lots of my headaqe wil be gone Smile | :)

Thx..

//My BaseTable
using System;
using System.Data;
using System.Reflection;
using System.Collections;

namespace Data
{
///
/// Summary description for BaseTable.
///

public abstract class BaseTable : System.Data.DataTable
{
#region contructors
public BaseTable(string name) : base(name)
{
this.InitializeComponent();
}
#endregion contructors

#region methods

///
/// Initiate all columns owned by the Table.
///

private void InitColumns()
{

IEnumerator columns = this.GetType().GetProperties().GetEnumerator();
PropertyInfo property;
columns.Reset();
while(columns.MoveNext())
{
property = (PropertyInfo) columns.Current;
if(property.PropertyType.ToString() == typeof(Column).ToString())
property.GetValue(this, null); //Just call the getter of the property to initiate the instance
}
}

private void InitializeComponent()
{
((System.ComponentModel.ISupportInitialize)(this)).BeginInit();
//
// BaseTable
//
this.InitColumns();
((System.ComponentModel.ISupportInitialize)(this)).EndInit();
}

#endregion methods

#region properties
public abstract System.Data.DataTable DataTable
{
get;
}

#endregion properties
}
}

//My Column
using System;
using System.Data;
using System.Reflection;
using System.Collections;



namespace Data
{
///
/// Summary description for Column.
///

public class Column : DataColumn
{
private bool systemColumn = false;
private bool indexColumn = false;

public Column(): base()
{
}

public Column(string name, string caption, TypeCode dataType): base(name,TypeCode2Type(dataType))
{
this.Caption = caption;
this.DataType = TypeCode2Type(dataType);
}

public Column(string name, string caption, TypeCode dataType, bool mandatory): base(name,TypeCode2Type(dataType))
{
this.Caption = caption;
this.DataType = TypeCode2Type(dataType);
this.AllowDBNull = mandatory;
}

public Column(string name, string caption, TypeCode dataType, int maxLength): base(name,TypeCode2Type(dataType))
{
this.Caption = caption;
this.DataType = TypeCode2Type(dataType);
if(dataType == TypeCode.String)
this.MaxLength = maxLength;
}

public Column(string name, string caption, TypeCode dataType, int maxLength, bool mandatory): base(name,TypeCode2Type(dataType))
{
this.Caption = caption;
this.DataType = TypeCode2Type(dataType);
if(dataType == TypeCode.String)
this.MaxLength = maxLength;
this.AllowDBNull = mandatory;
}

static Type TypeCode2Type(TypeCode typeCode)
{
return Type.GetType("System."+typeCode.ToString());
}

public SqlDbType Type2SqlDbType(System.Type type)
{
if(type == TypeCode2Type(TypeCode.Boolean))return SqlDbType.Bit;
if(type == TypeCode2Type(TypeCode.Byte)) return SqlDbType.TinyInt;
if(type == TypeCode2Type(TypeCode.Int16))return SqlDbType.SmallInt;
if(type == TypeCode2Type(TypeCode.Int32)) return SqlDbType.Int;
if(type == TypeCode2Type(TypeCode.Int64)) return SqlDbType.BigInt;
if(type == TypeCode2Type(TypeCode.Decimal)) return SqlDbType.Decimal;
if(type == TypeCode2Type(TypeCode.Single)) return SqlDbType.Real;
if(type == TypeCode2Type(TypeCode.Double)) return SqlDbType.Float;
if(type == TypeCode2Type(TypeCode.Char)) return SqlDbType.NChar;
if(type == TypeCode2Type(TypeCode.String)) return SqlDbType.NVarChar;
if(type == TypeCode2Type(TypeCode.DateTime)) return SqlDbType.DateTime;
if(type == TypeCode2Type(TypeCode.Object)) return SqlDbType.Variant;

return SqlDbType.Variant;
}

#region Properties

public bool SystemColumn
{
get{return this.systemColumn;}
set{this.systemColumn = value;}
}

public bool IndexColumn
{
get{return this.indexColumn;}
set{this.indexColumn = value;}
}

#endregion Properties

}
}

//Finaly a table
using System;
using System.Data;


namespace Data.Tables
{
///
///
///

public class DebTable : Data.BaseTable, IDebTableColumns
{
public DebTable() : base("DebTable")
{
InitializeComponent();
}

public DebTable(string name) : base(name)
{
InitializeComponent();
}

private void InitializeComponent()
{
//
// DebTable
//
this.PrimaryKey = new Column[] {this.DataColumns.Id};
}

///
/// Gets the Column owned by this Table.
///

public IDebTableColumns DataColumns
{
get {return this;}
}

public override System.Data.DataTable DataTable
{
get{return (System.Data.DataTable) this;}
}

#region IDebTableColumns Members
public Column Id
{
get
{
if (this.Columns["Id"] == null)
{
this.Columns.Add(new Column("Id", "ID", TypeCode.Int32, true));
((Column) this.Columns["Id"]).Unique = true;
((Column) this.Columns["Id"]).IndexColumn = true;

}
return (Column) this.Columns["Id"];
}
}

public Column Name
{
get
{
if (this.Columns["Name"] == null)
{
this.Columns.Add(new Column("Name", "Name", TypeCode.String, 30));
}
return (Column) this.Columns["Name"];
}
}
#endregion IDebTableColumns Members
}

public interface IDebTableColumns
{
Column Id
{
get;
}
Column Name
{
get;
}

}
}
GeneralRe: DataTable question... Pin
Sendilkumar.M28-Sep-04 17:25
Sendilkumar.M28-Sep-04 17:25 
GeneralRe: DataTable question... Pin
sreejith ss nair26-Sep-04 20:59
sreejith ss nair26-Sep-04 20:59 
GeneralRe: DataTable question... Pin
Besinci28-Sep-04 9:44
Besinci28-Sep-04 9:44 
GeneralCreating dockable form Pin
filburt126-Sep-04 7:11
filburt126-Sep-04 7:11 
GeneralRe: Creating dockable form Pin
Roger Alsing26-Sep-04 7:15
Roger Alsing26-Sep-04 7:15 
GeneralRe: Creating dockable form Pin
filburt129-Sep-04 10:41
filburt129-Sep-04 10:41 
Questionhow Terrarium work ? Pin
sssa200026-Sep-04 6:22
sssa200026-Sep-04 6:22 
AnswerRe: how Terrarium work ? Pin
Christian Graus26-Sep-04 12:20
protectorChristian Graus26-Sep-04 12:20 
GeneralRe: how Terrarium work ? Pin
peterchen26-Sep-04 12:47
peterchen26-Sep-04 12:47 
AnswerRe: how Terrarium work ? Pin
Anonymous27-Sep-04 1:24
Anonymous27-Sep-04 1:24 
GeneralCrystal Report and C# Windows Programming Pin
Member 103017926-Sep-04 3:54
Member 103017926-Sep-04 3:54 
GeneralRe: Crystal Report and C# Windows Programming Pin
Alex Korchemniy26-Sep-04 9:25
Alex Korchemniy26-Sep-04 9:25 
GeneralSQL Server Ce - Stored Procedures Pin
mathon25-Sep-04 22:56
mathon25-Sep-04 22:56 
GeneralRe: SQL Server Ce - Stored Procedures Pin
João Paulo Figueira25-Sep-04 23:59
professionalJoão Paulo Figueira25-Sep-04 23:59 
GeneralRe: SQL Server Ce - Stored Procedures Pin
mathon26-Sep-04 1:50
mathon26-Sep-04 1:50 
GeneralRe: SQL Server Ce - Stored Procedures Pin
João Paulo Figueira26-Sep-04 2:03
professionalJoão Paulo Figueira26-Sep-04 2:03 
GeneralRunning an application from my program Pin
youusuf25-Sep-04 21:20
youusuf25-Sep-04 21:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.