<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: create a simple table in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/create-a-simple-table/m-p/477235#M12931</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Replying to your own post, saying it can't be done and then marking it as answered is kind of comical. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'll assume that this is a .NET add-in since you are using ArcGIS 10. Just use the code in the link you provided but instead of opening the feature workspace in the manner described open it as an in memory workspace:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
//CREATE THE TABLE IN AN IN MEMORY WORKSPACE
IObjectClassDescription ocDescription = new ObjectClassDescriptionClass();
Type factoryType = Type.GetTypeFromProgID(
&amp;nbsp;&amp;nbsp;&amp;nbsp; "esriDataSourcesGDB.InMemoryWorkspaceFactory");
IWorkspaceFactory workspaceFactory = (IWorkspaceFactory)Activator.CreateInstance
&amp;nbsp;&amp;nbsp;&amp;nbsp; (factoryType);
IWorkspaceName workspaceName = workspaceFactory.Create("", "in_memory", null, 0);
IName name = (IName)workspaceName;
IFeatureWorkspace fws = (IFeatureWorkspace)name.Open();
string tableName = "tempTable";
ITable table = fws.CreateTable(tableName, fields, ocDescription.ClassExtensionCLSID, null, "");
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now you have an in memory ITable that you can use to create an xy event source. Cast the xy event source to a feature class and then to a feature layer and add it to your map document.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 21:05:07 GMT</pubDate>
    <dc:creator>RichWawrzonek</dc:creator>
    <dc:date>2021-12-11T21:05:07Z</dc:date>
    <item>
      <title>create a simple table</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/create-a-simple-table/m-p/477230#M12926</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to create a table "out of thin air" without backing it by some file. I want to create a StandaloneTable (or other ITable) with three columns. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The examples I am finding suggest using a featureworkspace which means using a file. I don't want to do that. See here: &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://www.codekeep.net/snippets/668235c3-789d-4ec3-8d54-a42ee53f5f01.aspx" rel="nofollow" target="_blank"&gt;http://www.codekeep.net/snippets/668235c3-789d-4ec3-8d54-a42ee53f5f01.aspx&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I want to simply create a table object and tell it to use 3 columns with specified names. That way I can populate the rows myself and create an x,y data layer from it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does the possibility to do what I want exist and if yes, would you please show me either an example or shortly explain? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Alex&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Feb 2012 22:10:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/create-a-simple-table/m-p/477230#M12926</guid>
      <dc:creator>AlexanderWolf</dc:creator>
      <dc:date>2012-02-16T22:10:59Z</dc:date>
    </item>
    <item>
      <title>Re: create a simple table</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/create-a-simple-table/m-p/477231#M12927</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Creating an X,Y Event layer from a table probably requires a stored table. If you want the end product to be a shapefile, creating and populating a shapefile would be easier.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I do have code to create a table in memory. Works in 9.3; not tested elsewhere. FinalTable is a global variable of type ITable.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Private Sub createDataTable()

&amp;nbsp;&amp;nbsp;&amp;nbsp; 'This function creates a table in memory to store data
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pFields As IFields
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pFieldsEdit As IFieldsEdit
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pField As IField
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pFieldEdit As IFieldEdit
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pFields = New Fields
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pFieldsEdit = pFields
&amp;nbsp;&amp;nbsp;&amp;nbsp; pFieldsEdit.FieldCount = 4

&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pField = New Field
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pFieldEdit = pField
&amp;nbsp;&amp;nbsp;&amp;nbsp; With pFieldEdit
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Length = 10
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Name = "OID"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Type = esriFieldTypeOID
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .IsNullable = False
&amp;nbsp;&amp;nbsp;&amp;nbsp; End With
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pFieldsEdit.Field(0) = pField

&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pField = New Field
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pFieldEdit = pField
&amp;nbsp;&amp;nbsp;&amp;nbsp; With pFieldEdit
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Length = 20
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Name = "PipeFID"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Type = esriFieldTypeString
&amp;nbsp;&amp;nbsp;&amp;nbsp; End With
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pFieldsEdit.Field(1) = pField

&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pField = New Field
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pFieldEdit = pField
&amp;nbsp;&amp;nbsp;&amp;nbsp; With pFieldEdit
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Length = 10
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Name = "ParcelsWI"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Type = esriFieldTypeInteger
&amp;nbsp;&amp;nbsp;&amp;nbsp; End With
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pFieldsEdit.Field(2) = pField

&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pField = New Field
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pFieldEdit = pField
&amp;nbsp;&amp;nbsp;&amp;nbsp; With pFieldEdit
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Length = 10
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Name = "ParcelsWIB"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Type = esriFieldTypeInteger
&amp;nbsp;&amp;nbsp;&amp;nbsp; End With
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pFieldsEdit.Field(3) = pField

&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Create the table using the created fields
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pRecordSet As IRecordSet
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pRecordSet = New RecordSet
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pRSInit As IRecordSetInit
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pRSInit = pRecordSet
&amp;nbsp;&amp;nbsp;&amp;nbsp; pRSInit.CreateTable pFields
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set FinalTable = pRecordSet.table

End Sub&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To add data to the table:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Dim pRow As IRow
Set pRow = FinalTable.CreateRow
pRow.Value(pRow.Fields.FindField("PipeFID")) = "myvalue"
pRow.Value(pRow.Fields.FindField("ParcelsWI")) = 5
pRow.Value(pRow.Fields.FindField("ParcelsWIB")) = 2
pRow.Store&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:05:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/create-a-simple-table/m-p/477231#M12927</guid>
      <dc:creator>PaulKroseman</dc:creator>
      <dc:date>2021-12-11T21:05:04Z</dc:date>
    </item>
    <item>
      <title>Re: create a simple table</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/create-a-simple-table/m-p/477232#M12928</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you krosemanp for your answer. This almost works for me using arcobjects 10. I'm receiving a COMException when trying to update the columns of the row I just created. In your code it would be this line:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;pRow.Value(pRow.Fields.FindField("PipeFID")) = "myvalue"&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;The error I receive is: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;The workspace is not connected.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;Since I have created my own Form and added a mapcontrol I must have overlooked something about setting up a valid workspace or something... what could it be?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Alex&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Feb 2012 13:21:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/create-a-simple-table/m-p/477232#M12928</guid>
      <dc:creator>AlexanderWolf</dc:creator>
      <dc:date>2012-02-20T13:21:11Z</dc:date>
    </item>
    <item>
      <title>Re: create a simple table</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/create-a-simple-table/m-p/477233#M12929</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have nothing relating to workspaces in my code. The code for pRow.Value was written within the ThisDocument area of the mxd file. You may have to create a workspace object or get a reference to your map control's workspace when running ArcObjects code in an add-in, extension, or outside program. I don't have any code on hand to provide for this.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Feb 2012 18:16:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/create-a-simple-table/m-p/477233#M12929</guid>
      <dc:creator>PaulKroseman</dc:creator>
      <dc:date>2012-02-23T18:16:45Z</dc:date>
    </item>
    <item>
      <title>Re: create a simple table</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/create-a-simple-table/m-p/477234#M12930</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;As far as I have found, this is not possible in ArcObjects 10. I have resorted to loading the table from a file by using an oledb workspace.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Feb 2012 09:51:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/create-a-simple-table/m-p/477234#M12930</guid>
      <dc:creator>AlexanderWolf</dc:creator>
      <dc:date>2012-02-24T09:51:46Z</dc:date>
    </item>
    <item>
      <title>Re: create a simple table</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/create-a-simple-table/m-p/477235#M12931</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Replying to your own post, saying it can't be done and then marking it as answered is kind of comical. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'll assume that this is a .NET add-in since you are using ArcGIS 10. Just use the code in the link you provided but instead of opening the feature workspace in the manner described open it as an in memory workspace:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
//CREATE THE TABLE IN AN IN MEMORY WORKSPACE
IObjectClassDescription ocDescription = new ObjectClassDescriptionClass();
Type factoryType = Type.GetTypeFromProgID(
&amp;nbsp;&amp;nbsp;&amp;nbsp; "esriDataSourcesGDB.InMemoryWorkspaceFactory");
IWorkspaceFactory workspaceFactory = (IWorkspaceFactory)Activator.CreateInstance
&amp;nbsp;&amp;nbsp;&amp;nbsp; (factoryType);
IWorkspaceName workspaceName = workspaceFactory.Create("", "in_memory", null, 0);
IName name = (IName)workspaceName;
IFeatureWorkspace fws = (IFeatureWorkspace)name.Open();
string tableName = "tempTable";
ITable table = fws.CreateTable(tableName, fields, ocDescription.ClassExtensionCLSID, null, "");
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now you have an in memory ITable that you can use to create an xy event source. Cast the xy event source to a feature class and then to a feature layer and add it to your map document.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:05:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/create-a-simple-table/m-p/477235#M12931</guid>
      <dc:creator>RichWawrzonek</dc:creator>
      <dc:date>2021-12-11T21:05:07Z</dc:date>
    </item>
  </channel>
</rss>

