' ~~~~~~~~~~~~~~~~~~~~ Манакбаев У. от 03.07.2004 1:09:51
Function CreateTableOnMDB(ByVal pFWorkspace As IFeatureWorkspace, TableName As String) As ITable
Dim pObjClassDescr As IObjectClassDescription
Set pObjClassDescr = New ObjectClassDescription
Dim pFields As IFieldsEdit
Set pFields = pObjClassDescr.RequiredFields
pFields.AddField CreateField("Name", esriFieldTypeString, 512)
pFields.AddField CreateField("Value", esriFieldTypeString, 1024)
Dim pDataset As IDataset
Set pDataset = pFWorkspace.CreateTable(TableName, pFields, Nothing, Nothing, "")
Set CreateTableOnMDB = pDataset
End Function
Private Function CreateField(ByVal sName As String, FieldType As esriFieldType, _
Optional Length As Variant, Optional Nullable As Boolean = True) As IField
Dim pFieldEdit As IFieldEdit
Set pFieldEdit = New Field
With pFieldEdit
.Name = sName
.Type = FieldType
If Not IsMissing(Length) Then
.Length = Length
End If
.IsNullable = Nullable
.Editable = True
End With
Set CreateField = pFieldEdit
End Function