cancel
Showing results for 
Search instead for 
Did you mean: 

Invalid Code(173-36) Error on adding record to Usertable

Former Member
0 Kudos

Dear Support,

I have designed a form in screen painter and also added controls, even for Code and Name. Then I binded all the contols to table fields via sdk.I have registered usertable as UDO of Type Master.Then in the fordataevent BusinessObjectInfo.BeforeAction = True, I have created an object of the usertable and set values for Code and Name.but application generating an error 'Invalid Code (173-36).I was not able to insert any record to usertable. But on checking the form.BusinessObject.key in the formdata event, it returs an empty string.Since its an userdefined table How we can set Object key for the Table?.Does Object Key means code field. Can any one help me Please.

Thanks in advance.

Edited by: Nirmala Thomas on Aug 3, 2009 1:56 PM

Accepted Solutions (1)

Accepted Solutions (1)

former_member201110
Active Contributor
0 Kudos

Hi Nirmala,

You cannot add data to a UDO-type user-defined table in this way. The UserTable object in the DI API is used to manipulate data in non-UDO tables and won't work for UDOs.

Typically with a UDO all you need to do is set the ObjectType property of the form to the name of your UDO and then bind the controls to the fields of the table. SBO will then automatically provide the functionality to add and edit data. Alternatively, don't register your table as a UDO and then you can read and write data to it using the UserTable object

Since patch 47 of SBO 2007A there has been a new object in the DI API to manipulate UDO data directly through the DI API.

Kind Regards,

Owen

Answers (3)

Answers (3)

Former Member
0 Kudos

Dear Firos,

I have generated code by an autoincrementing function. but initially I binded textfield control to code field and assigned value to textfield. But here you assigned value first and then only you binded that control to code field.Which is the right way of assigning value? Even if I tried all these methods invalid error code is still coming..Please suggest me a solution.

Thanks in advance.

Nirmala Thomas

Former Member
0 Kudos

Hello

U getting line of series through that fn right..?

Then assign that value to one text box and bind that text box with Code field.

Hope this help u...

Former Member
0 Kudos

Dear Support,

Thanks for the reply.I have already added ObjectType property of the form to the name of the UDO and then binded the controls to the fields of the table.Since its a master type UDO I have binded controls for code and Name also.But Invalid Error Code is coming when inserting data.No data get inserted into the table. I am trying for a first time Insert into the table.Can you suggest me any proper event to assign values to code and name field. I have already tried formdata event and item event.Now I made it as an entry field.No way Its not working.Any suggestions Please..

Regards,

Nirmala Thomas

Former Member
0 Kudos

HI

Generate Code serial by coding..You can try this alternative


rs.Doquery("Select Max(Code) from [@tablename]")
Dim S As string = rs.Field.item(0).value
if S = string.empty  or something  Then 
oEditText =1  'If no data exist in database
Else
oEdittext = S+ 1
End if

Then bind oEdittext text to Code field.

By

Firos.C

Former Member
0 Kudos

Hello,


Ur Code(primary key) of table Type master not getting incremented. U have to increment code each record  like series of numbers 1,2,3...
I think while inserting record into database ur same code is inserting. Go and check in database. i think one record u r inserted with Code value as 0

Hope help u..

[R u a Mallu(Kerala)..like me.]

By

Firos.C

Edited by: firoz101 on Aug 4, 2009 5:40 AM