ActiveReport_ReportStart bind subreport script
-
25-06-2021 - |
Question
I'm using Active Reports Subreport tool, I want to bind data source in ActiveReport_ReportStart as script by connecting Oracle. I'm using the script below but I'm having this error: Error Message:[DBNETLIB][Connection Open (Connect()).]SQL Server does not exist or access denied. Invalid connection string attribute.
public void ActiveReport_ReportStart()
{
string connString = "Provider=SQLOleDB;User Id=XXX;Password=XX;Server=XXX;Service Name=XX;Direct=True;Persist Security Info=True";
string sqlString = @"sql query";
DataDynamics.ActiveReports.DataSources.OleDBDataSource ds = new DataDynamics.ActiveReports.DataSources.OleDBDataSource();
ds.ConnectionString = connString;
ds.SQL = sqlString;
rpt.DataSource = ds;
}
Thanks in advance...
Solution
As far as ActiveReports goes, I don't see anything wrong. I haven't had time to look into this in any detail, but it is probably your connection string. The error message is from SQLServer/OLEDB, it is just bubbling up via ActiveReports.
Try using the same connection string with a System.Data.OleDB.OleDBConnection object and see if it works. If you get an error there too, it is definitely your connection string. If not, let me know and I'll have a closer look.
You might also want to try to use the built-in connection string builder in the ActieReports Designer and get it working there and then copy it into the script.