cancel
Showing results for 
Search instead for 
Did you mean: 

invalid field name error

Former Member
0 Kudos

m geeting invalid field value in the line

Private Function AddBookToDatabase(ByVal Code As String, ByVal Name As String, ByVal Stock As String) As Boolean

' Dim oRecordSet As SAPbobsCOM.Recordset

Dim oUsrTbl As SAPbobsCOM.UserTable

'Dim oUsrTbl As SAPbobsCOM.Recordset

Dim sSQL As String

Dim Res As Integer

'Dim oUsrTbl As SAPbobsCOM.Items

' sSQL = "SELECT U_bookid,U_bookname FROM @BK_DATA WHERE U_bookid='" & Code & "'"

'oUsrTbl = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)

'oUsrTbl = oCompany.UserTables.Item("BKD")

'Try

'oUsrTbl.DoQuery(sSQL)

'Catch ex As Exception

' MessageBox.Show(ex.Message)

'End Try

AddBookToDatabase = False

Try

oUsrTbl = oCompany.UserTables.Item("BK_DATA")

oUsrTbl.Code = CInt(Code)

oUsrTbl.Name = Name

oUsrTbl.UserFields.Fields.Item("Stock").Value = Stock----


(Error Line)

'oUsrTbl.UserFields.Fields.Item("U_SPACE").Value = Space()

Res = oUsrTbl.Add()

Catch ex As Exception

MessageBox.Show(ex.Message)

End Try

AddBookToDatabase = False

'oUsrTbl.Code = CInt(Code)

'oUsrTbl.Name = Name

''oUsrTbl.UserFields.Fields.Item("U_").Value = Code

''oUsrTbl.UserFields.Fields.Item("U_NAME").Value = Name

'Res = oUsrTbl.Command.Execute()

If Res = 0 Then

AddBookToDatabase = True

Else

SBO_Application.MessageBox("Error, failed to add movie")

End If

End Function

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I think that UDF field must begin with U_

("Stock"). -> ("U_Stock").

Former Member
0 Kudos

should i change in the database or in .net code

Former Member
0 Kudos

change the code in .net to

oUsrTbl.UserFields.Fields.Item("U_Stock").Value = Stock

I think that the user field wasnt made directly in db, but in sbo or with sdk.

Answers (0)