C1Report, problems with odbc connection

Posted by: jacopo.bianchi on 18 October 2018, 1:16 am EST

    • Post Options:
    • Link

    Posted 18 October 2018, 1:16 am EST

    Hi,

    I’ve a problem with the reports after a migration of a server from sql2005 to 2016.

    To create a report, I read an xml file, and then set the SQL query to filter the data I need.

    This is the code I use to create the report, and it worked without any problem:

    Dim C1R As New C1Report

    C1R.Load(xmlDoc, “report1”) // I charge the xml doc without any problem

    C1R.DataSource.ConnectionString = “Provider=SQLOLEDB.1;Password=xxx;User ID=yyy;Initial Catalog=” + DBName + “;Data Source=” + ServerName + “;Connection Timeout=15;”

    C1R.DataSource.RecordSource = “SELECT * FROM …”

    But when I try to do this:

    C1R.RenderToFile(NomeFile, FileFormatEnum.PDF)

    it doesn’t work: Cannot open data source, please check ConnectionString and RecordSource properties.

    The connection works properly if I try to create an ODBC connection with the same string (I can open it, fill a dataset, close the odbc connection without any problem).

    The same credentials of user, password, server name etc. used in a SQLConnection work properly.

    The query has no problems…

    Isn’t it possible, for example, not to use the RecordSource and pass a DataSet, or a DataTable, to the RecordSet to avoid that the Report try to open the odbc connection and run the query, having yet the results?

  • Posted 18 October 2018, 1:19 am EST

    Sorry, the title should be “problems with OLEDB connection”…

  • Posted 21 October 2018, 7:48 pm EST

    Hello,

    For OLEDB connection, please modify the data provider’s name in the connection string as follows:

    C1R.DataSource.ConnectionString = "Provider=[b]Microsoft.Jet.OLEDB.4.0;[/b] Data Source=..."
    C1R.DataSource.RecordSource = "Select * From ...."
    

    Please inform in case the issue persists. Also, which ComponentOne builds are you using?

    Further, the below mentioned documentation link shows how DataTable objects can be used to bind a C1Report:

    http://help.grapecity.com/componentone/NetHelp/c1report/webframe.html#usingyourowndatatabl.html

    http://help.grapecity.com/componentone/NetHelp/c1wpfreport/webframe.html#C1.WPF.C1Report.4~C1.C1Report.DataSource.html

    Best Regards,

    Esha

    Note: C1Report is now obsolete: https://www.grapecity.com/en/forums/wpf-edition/c1report-is-now-obsolete-t

Need extra support?

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

Learn More

Forum Channels