on 2016 Dec 13 3:15 PM
Hi all,
I have a problem in SDK codes,
I opened project in C:\Program Files\SAP\SAP Business One SDK\Samples\UDO\addUDO\VB.NET then I added new textbox3 in order to understand well how SDK codes work.
If I use use TextBox3.Text I can add data to database as shown bellow
Try
oCompanyService = oCompany.GetCompanyService
'Get GeneralService (oCmpSrv is the CompanyService)
oGeneralService = oCompanyService.GetGeneralService("SM_MOR")
'Create data for new row in main UDO
oGeneralData = oGeneralService.GetDataInterface(SAPbobsCOM.GeneralServiceDataInterfaces.gsGeneralData)
oGeneralData.SetProperty("U_Price", TextBox3.Text)
But if I declare variable and assign value of TextBox3 to that the variable I cannot add data to the database, the following error message is displayed Illegal value entered
Dim TestNumber1 As Integer
Try
TestNumber1 = Val(TextBox3.Text)
oCompanyService = oCompany.GetCompanyService
'Get GeneralService (oCmpSrv is the CompanyService)
oGeneralService = oCompanyService.GetGeneralService("SM_MOR")
'Create data for new row in main UDO
oGeneralData = oGeneralService.GetDataInterface(SAPbobsCOM.GeneralServiceDataInterfaces.gsGeneralData)
oGeneralData.SetProperty("U_Price", TestNumber1)
Please anyone can help me.
Hi Rurangwa,
This happened because in the sample, the field U_Price on the database is a alpha field and your variable is an integer. Change the type of your variable to string.
Kind Regards,
Diego Lother
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
109 | |
8 | |
6 | |
4 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.