cancel
Showing results for 
Search instead for 
Did you mean: 

Error creating user defined tables: Ref count (-1120)

Former Member
0 Kudos

Hi all !

I have to create user defined tables per code, so I wrote <b>2 main functions</b>, first <i>to create a table</i> (with TableName,TableType and TableDescription properties)and and <i>second to add fields</i> (to a certain table which is sent as parameter).

I call these functions to create multiple tables. For the first 6 tables it works totally ok. But beginning from the 7th table it gives that "<b>Ref count for this object is higher then 0.</b> " (-1120) error. All parameters are ok just as the first 6 tables.

Found such an explanation like below in help files.

<i>The DI API allows only one instance of a meta data object at a time. This maintains data integrity by preventing any manipulation of a business object while modifying the object's user fields. Therefore, verify that no other DI object is active except the meta data object.</i>

But why do I get such an error after sixth call of the function (but not beginning from the second table )?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

See also thread & answer by Yaniv G.

Former Member
0 Kudos

Thnx for ur replies Juha

I'm not using a recordset to create them. Additionally I'm already using "<b>System.Runtime.InteropServices.Marshal.ReleaseComObject()</b>" which Yaniv mentioned in this thread and keep getting -1120 error.

Former Member
0 Kudos

Solved.

I was removing not the user table object, but the user field object before using "System.Runtime.InteropServices.Marshal.ReleaseComObject()"

So, when it's not removed before garbage collection,it works ok.

Answers (1)

Answers (1)

Former Member
0 Kudos

Gül,

Have you tried doing some grbage collection?

Search for a topic: "Add Usertables and Fields while having a recordset"

HTH

Juha