Skip to Content
author's profile photo Former Member
Former Member

Matrix.FlushToDataSource()

After i put Matrix.FlushToDataSource() inside my vb.net code but cannot update inside database?

Can anyone help me?

Thank you.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Apr 03, 2008 at 05:03 AM

    Danny,

    Can u give me ur code so that i can help u? Becoz i use FlushToDataSource its working fine.

    ELse

    U refer this code below which i used in my module.

    Sub LoadCFL(ByVal IndentNo As String)

    Try

    Dim Rec As SAPbobsCOM.Recordset

    Dim oMat As SAPbouiCOM.Matrix

    Rec = com.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)

    oMat = RQ_Frm.Items.Item("m_part").Specific

    Rec.DoQuery("select a.U_indno,b.U_itno,b.U_itdesc,b.U_qnos,b.U_unit from [@PUR_PI_HEAD] a,[@PUR_PI_DETAIL] b where a.DocEntry=b.DocEntry and a.U_indno='" & Trim(IndentNo) & "' and a.U_appr='1' and U_apdep='1' and U_appr='1' and U_dir='1' and b.U_itno Not in (Select b.U_Pno from [@PUR_RQ_HEAD] a,[@PUR_RQ_PART] b,[@PUR_PI_HEAD] c WHERE a.DocEntry=b.DocEntry and convert(nvarchar,c.U_indno)=a.U_INo and a.U_INo='" & Trim(IndentNo) & "')")

    oMat.Clear()

    oMat.FlushToDataSource()

    For i As Integer = 1 To Rec.RecordCount

    PART_oDBds.InsertRecord(i)

    oMat.AddRow()

    'MsgBox(CStr(Rec.Fields.Item(1).Value) & CStr(Rec.Fields.Item(2).Value))

    PART_oDBds.Offset = i - 1

    PART_oDBds.SetValue("U_Pno", PART_oDBds.Offset, CStr(Rec.Fields.Item(1).Value))

    PART_oDBds.SetValue("U_PName", PART_oDBds.Offset, CStr(Rec.Fields.Item(2).Value))

    PART_oDBds.SetValue("U_qty", PART_oDBds.Offset, Rec.Fields.Item(3).Value)

    PART_oDBds.SetValue("U_Unit", PART_oDBds.Offset, CStr(Rec.Fields.Item(4).Value))

    oMat.SetLineData(i)

    Rec.MoveNext()

    Next

    oMat.FlushToDataSource()

    Catch ex As Exception

    app.MessageBox(ex.Message)

    End Try

    End Sub

    If it helps reward points,

    Regards,

    Anitha

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 03, 2008 at 06:36 AM

    Dear,

    FlushtoDataSource will not update Database, It will update DataTable/DataSource which you have bind with Matrix.

    To Update Database you have to write code.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Maria Trinidad MARTINEZ GEA

      Hi Trinidad,

      This is my latest code:

      For rowNum = 1 To oMatrix.RowCount

      oMatrix.Columns.Item("DSCode").Cells.Item(rowNum).Specific.Value = oRecordset.Fields.Item("Code").Value

      oMatrix.Columns.Item("DSName").Cells.Item(rowNum).Specific.Value = oRecordset.Fields.Item("Name").Value

      oMatrix.Columns.Item("DSReport").Cells.Item(rowNum).Specific.Value = oRecordset.Fields.Item("U_RPTC").Value

      oMatrix.Columns.Item("DSUser").Cells.Item(rowNum).Specific.Value = oRecordset.Fields.Item("U_USRC").Value

      oRecordset.Update();

      oRecordset.MoveNext()

      Next

      Then the message box prompt this error:

      Row - Invalid index 66000-31

      regards,

      danny

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.