ConnectionString SubReport

Posted by: hoang.tranduc2609 on 23 February 2021, 10:33 pm EST

    • Post Options:
    • Link

    Posted 23 February 2021, 10:33 pm EST

    Hi I want to my SubReport run with new ConnectionString. This My CODE vb.net

            ConnStr = "Provider=OraOLEDB.Oracle;Password=" & Q_Save_Pass & ";Persist Security Info=True;User ID=" & Q_Save_User & ";Data Source=" & Q_Save_Serv
    For i As Integer = 0 To reportName.Count - 1
                If flexReport.Fields.FindByName(reportName(i)) IsNot Nothing Then
                    CType(flexReport.Fields.FindByName(reportName(i)), SubreportField).Subreport.DataSource.ConnectionString = ConnStr
                End If
            Next
    
  • Posted 24 February 2021, 5:45 pm EST

    Hello,

    You can take the SubReport field into the FlexReport object and then assign the data source as you do in FlexReport. The code snippet for the same is given below:

    Dim sub As SubreportField
    sub = (SubreportField)c1FlexReport1.Fields("SubReportFieldName")
    
    Dim rptSubreport as C1FlexReport  = sub.Subreport
    Dim ds As DataSource = rptSubreport.DataSource
    ds.ConnectionString = "Provider=OraOLEDB.Oracle;Password=" & Q_Save_Pass & ";Persist Security Info=True;User ID=" & Q_Save_User & ";Data Source=" & Q_Save_ServSamples\Common\C1Nwind.mdb;"
    ds.RecordSource = "TableName"
    rptSubreport.DataSource.Recordset = table;
    

    If you face any issue in using it then please let us know.

    Regards,

    Prabhat Sharma.

  • Posted 24 February 2021, 7:18 pm EST - Updated 3 October 2022, 2:21 pm EST

    Hi I have report on this image



    On my computer I setting ConnectionString .But On My Client have another ConnectionString I want to setting on code VB.Net change only ConnectionString. I Try

    If flexReport.Fields.FindByName(SubReportFieldName(i)) IsNot Nothing Then

    CType(flexReport.Fields.FindByName(SubReportFieldName(i)), SubreportField).Subreport.DataSource.DataProvider = 1

    CType(flexReport.Fields.FindByName(reportName(i)), SubreportField).Subreport.DataSource.ConnectionString = ConnStr

    End If

    But I received a report with no information

  • Posted 25 February 2021, 7:07 pm EST

    Hello,

    Can you please share your report file with dummy data [excel file or .mdb file] so that we can try to replicate the issue at our end and assist you better?

    Regards,

    Prabhat Sharma.

  • Posted 28 February 2021, 3:52 pm EST

    My report have SQL and String Connect. I want change String Connect. This is My File Report CYG_J10_100R0.zip

  • Posted 2 March 2021, 10:04 pm EST

    Hello,

    It is not possible to reproduce the issue without data as your reports have too many fields linked from DB.

    I have created a small project, please see if you face any issue with it.

    Also, it will be very helpful if you can modify it as per your report to replicate the issue.

    Regards,

    Prabhat Sharma.

  • Posted 3 March 2021, 2:00 pm EST - Updated 3 October 2022, 2:16 pm EST

    Hello

    Please show me your small project.

    Regards

  • Posted 3 March 2021, 2:53 pm EST

    Here it is.

    SubReportDemo.zip

  • Posted 4 March 2021, 3:01 pm EST - Updated 3 October 2022, 2:16 pm EST

    I have solved my problem. Thank you very much

    Regards

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels