Hi:
What is the best way to copy the schema of one DataTable to another ?,
The DataTable.Clone will create a new DataTable
Currently i do it manually
destTable.Clear()
destTable.Columns.Clear()
destTable.Constraints.Clear()
For Each dcSrc In srcTable.Columns
dcDest = destTable.Columns.Add()
dcDest.AllowDBNull = dcSrc.AllowDBNull
dcDest.AutoIncrementStep = dcSrc.AutoIncrementStep
dcDest.AutoIncrementSeed = dcSrc.AutoIncrementSeed
dcDest.AutoIncrementStep = dcSrc.AutoIncrementStep
dcDest.Caption = dcSrc.Caption
dcDest.ColumnMapping = dcSrc.ColumnMapping
dcDest.ColumnName = dcSrc.ColumnName
dcDest.DataType = dcSrc.DataType
dcDest.DefaultValue = dcSrc.DefaultValue
dcDest.Expression = dcSrc.Expression
dcDest.MaxLength = dcSrc.MaxLength
dcDest.Namespace = dcSrc.Namespace
dcDest.Prefix = dcSrc.Prefix
dcDest.ReadOnly = dcSrc.ReadOnly
dcDest.Unique = dcSrc.Unique
Next
There must be an easy way to achieve this, any idea ?
JCVoon