Skip to Content
0
Former Member
Jun 06, 2008 at 11:30 AM

invalid field name error

442 Views

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