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?