AutoCAD Map 3D Developer
Welcome to Autodesk’s AutoCAD Map 3D Developer Forums. Share your knowledge, ask questions, and explore popular AutoCAD Map 3D Developer topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Modifying Object Datatable add field definition.

0 REPLIES 0
Reply
Message 1 of 1
raghulan
437 Views, 0 Replies

Modifying Object Datatable add field definition.

Hello All,

 

I want to get the datatable using the table name and modify the table

 

to add additional columns(Field definitions) but i am not able to do it.

 

here is what i have tried please assist...

 

=======================================================

 

public static void add_fld(string tables_name, string c)
{
Tables tables = HostMapApplicationServices.Application.ActiveProject.ODTables;
Autodesk.Gis.Map.ObjectData.Table table = tables[tables_name];
MapApplication app = HostMapApplicationServices.Application;

if (!IsTableExisted(tables, tables_name))
{
Global.variables.ed.WriteMessage("\n The table doesn't exist.");
return;
}


Global.variables.ed.WriteMessage("\n The table exist.");


FieldDefinitions tabDefs = table.FieldDefinitions;

FieldDefinition def4 = FieldDefinition.Create("FIRST_FIELD", "String Type", "A");
tabDefs.AddColumn(def4, 4);

//table.FieldDefinitions.AddColumn(def1, 4);
tables.UpdateTable(table.Name, tabDefs);
}

Regards,

Raghulan Gowthaman Cert IV TAA, B.E,.
Senior Technical Consultant | Developer - R&D
A2K Technologies Sydney
Web : www.a2ktechnologies.com.au
www.civil3dforum.com | www.e4forums.com
www.zcodia.com.au
www.raghulangowthaman.com
0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost