Skip to Content

How to insert Table's records in matrix row by row using RecordSet

Hi I am trying to add records from my no object table to matrix but i am getting exception "Bad value " where i am trying to add Name at Ename field of matrix.can any one give me the solution.

thanks and regards

Megha

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Oct 30, 2017 at 07:56 AM

    here is my code

    Dim i As Integer recset = ocmp.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)

    ocp = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_FormCreationParams)

    ocp.UniqueID = "MForm" ocp.FormType = "MForm"

    ocp.BorderStyle = SAPbouiCOM.BoFormBorderStyle.fbs_Fixed

    oform = SBO_Application.Forms.AddEx(ocp)

    oform.Height = 250

    oform.Width = 300

    oitem = oform.Items.Add("Matrix", SAPbouiCOM.BoFormItemTypes.it_MATRIX)

    oitem.Top = 5

    oitem.Left = 5

    oitem.Width = 250

    oitem.Height = 200

    omatrix = oitem.Specific

    ocolumns = omatrix.Columns

    ocolumn = ocolumns.Add("Ecode", SAPbouiCOM.BoFormItemTypes.it_EDIT)

    ocolumn.Width = 50

    ocolumn.Editable = True

    ocolumn.TitleObject.Caption = "Code"

    ocolumn = ocolumns.Add("EName", SAPbouiCOM.BoFormItemTypes.it_EDIT)

    ocolumn.TitleObject.Caption = "Name"

    ocolumn.Width = 50

    ocolumn.Editable = True

    ocolumn = ocolumns.Add("ECurrkey", SAPbouiCOM.BoFormItemTypes.it_EDIT)

    ocolumn.TitleObject.Caption = "CurrKey"

    ocolumn.Width = 50

    ocolumn.Editable = True

    recset.DoQuery("select Code,Name,U_CurrKey from [@SERVER] ")

    'Dim CODE As String = recset.Fields.Item(0).Value

    'Dim NAME As String = recset.Fields.Item(1).Value

    'Dim CURRKEY As String = recset.Fields.Item(2).Value

    If recset.RecordCount > 0 Then

    For i = 0 To 2

    omatrix.AddRow()

    'While recset.EoF = False

    omatrix.Columns.Item("Ecode").Cells.Item(omatrix.VisualRowCount).Specific.value = recset.Fields.Item(0).Value 'CODE omatrix.Columns.Item("EName").Cells.Item(omatrix.VisualRowCount).Specific.value = recset.Fields.Item(1).Value 'CODE 'NAME omatrix.Columns.Item("ECurrkey").Cells.Item(omatrix.VisualRowCount).Specific.value = recset.Fields.Item(2).Value 'CURRKEY omatrix.AddRow(2)

    If recset.EoF = False

    Then recset.MoveNext()

    ElseIf recset.BoF = False Then

    recset.MovePrevious()

    End If

    ' End While

    Next i

    End If

    End Sub

    Add comment
    10|10000 characters needed characters exceeded