Create New Empty Table And Add It To The Table Of Contents - Problem/Error

353
1
04-22-2010 03:37 AM
AndreMende
New Contributor
Hello Developers,

i have to create an empty table and add this table to the map. (later i will fill the table with information)
The following code produces an error: "Run-time error' -2147220985 (80040207)'"
Maybe everyone can help me to find the problem? Thanks a lot!

Greets, André Mende

_____________________________________________________________________________________


Private Sub btnCreateStandaloneTable_Click()

Dim pTable As ITable
Dim pFeatureWorkspace As IFeatureWorkspace
Dim pWorkspaceFactory As IWorkspaceFactory
Dim pWorkspace As IWorkspace

Set pWorkspaceFactory = New TextFileWorkspaceFactory
Set pWorkspace = pWorkspaceFactory.OpenFromFile("C:\Workspace", 0)
Set pFeatureWorkspace = pWorkspace

Dim pFieldsEdit As IFieldsEdit
Dim pFields As IFields
Set pFields = New Fields
Set pFieldsEdit = pFields

Set pTable = pFeatureWorkspace.CreateTable("Test", pFieldsEdit, Nothing, Nothing, "") 'the row with the error

End Sub
0 Kudos
1 Reply
jp
by
New Contributor II
It has been a long time since you posted this but I ran into this same error. It worked with "test.txt" for tablename.

Hello Developers,

i have to create an empty table and add this table to the map. (later i will fill the table with information)
The following code produces an error: "Run-time error' -2147220985 (80040207)'"
Maybe everyone can help me to find the problem? Thanks a lot!

Greets, André Mende

_____________________________________________________________________________________


Private Sub btnCreateStandaloneTable_Click()

Dim pTable As ITable
Dim pFeatureWorkspace As IFeatureWorkspace
Dim pWorkspaceFactory As IWorkspaceFactory
Dim pWorkspace As IWorkspace

Set pWorkspaceFactory = New TextFileWorkspaceFactory
Set pWorkspace = pWorkspaceFactory.OpenFromFile("C:\Workspace", 0)
Set pFeatureWorkspace = pWorkspace

Dim pFieldsEdit As IFieldsEdit
Dim pFields As IFields
Set pFields = New Fields
Set pFieldsEdit = pFields

Set pTable = pFeatureWorkspace.CreateTable("Test", pFieldsEdit, Nothing, Nothing, "") 'the row with the error

End Sub
0 Kudos