I am trying to create a dynamic data source in SSRS. I have a generic report that needs to be run across multiple database servers, requiring a way to connect to each based on a parameter.
I have setup my parameters in a way where I can generate the following connection string:
Data Source=172.16.1.111;Initial Catalog=TESTDB
If I plug that connection string into the "Connection String" text area field in the Data Source Properties window and click "Test Connection," I get the "Connection created successfully" message.
However, if I attempt to create an expression with the same data source (forget about the dynamic data source for a minute), like as shown below, I get a "The ConnectionString property has not been initialized" error message when trying to test the connection.
="Data Source=172.16.1.111;Initial Catalog=TESTDB"
Based on other examples I have seen looking this up online, this type of connection string definition is supposed to work.
My end goal is to create something like:
="Data Source=" + Parameter!Server.Value + ";Initial Catalog=" + Parameter!Database.Value
which would allow me to connect to any database based on the user selection.
Does anyone have any suggestions for what I might be doing wrong? I am using SQL Server 2014 Report Builder.
This ended up being an issue with the report builder. Once I deployed the report I was able to get this work. For some reason, even if you hard code the connection string as I mentioned above, expressions will not evaluate at runtime when running from within the report builder.
Hope this helps someone else in the future!
Related
I am trying to deploy a SSRS report to a 2016 server which uses a an API as it's data source. The URL for the API is generated dynamically via an expression which builds the query string based on a couple of report parameters.
In the past, using report manager I could set which account the API is called under.
Note that in the above screenshot the Connection string is still expression based.
However if I attempt the same thing in 2016 the connection string is wiped out.
Surely the connection string and the credentials should be independent, why has this changed in 2016 or is it a bug?
I had a similar issue in ReportServer 2017; however if you click the button 'Revert to Default' (visible in the above screenshot) the Expression based connection string will magically reappear!
Nice feature - if you find it ;-)
I have a local SQL DB and an Azure SQL DB. In my data flow I am trying to pass data from local (ole db source) to Azure (ole db destination).
I am unable to save the password for the connection string so I have parameterized the connection string of the data flow task but I seem unable to work out how to get the destination to use it?
I know this isn't best practice but I just want to prototype a few things. Is this possible?
Thanks
Double click project params and add your connection string as a parameter. Give it any name you want, select string then paste your Azure connection string that you have copied directly from you Azure portal connection string option.
This creates a project level conn string parameter.
Right click connection managers and create a new ADO.Net connection manager. This should be fairly straightforward.
Once completed, select this connection manager and add an expression to it from the property window:
In the Property Expression Editor: (1) Select a property called ConnectionString. (2) Select the elipsis beside expression. From the pop up open the project parameters in the left hand area and you will see the connection parameter you created earlier. Drag this into the expression text area. Evaluate the expression to check it works.
Click OK
You should now be able to use this as an Azure connection without getting any errors
I support a LOB application written in MS Access VBA with a SQL Server back end. One feature of the application is the ability to open a second instance of the application, allowing the users to view/modify two records at the same time.
The first time I open the application it connects and everything works fine. However when I attempt to open the second instance I get the following error message:
-2147467259 - Method "OpenConnection" of object _CurrentProject failed.
This is the line of code executing when the error occurs:
CurrentProject.OpenConnection strConnection
I have stepped through the code and verified that strConnection is the same connection string in both the first and second instances of the application
I'm running out of things to look for. Any ideas are greatly appreciated!
UPDATE: It appears that something is not allowing the second MSACCESS.EXE instance to use the same connection string. My connection string is below, with database and server substituted for the actual database and server.
PROVIDER=SQLOLEDB.1;INTEGRATED SECURITY=SSPI;PERSIST SECURITY INFO=FALSE;INITIAL CATALOG=database;DATA SOURCE=server
Try
MultipleActiveResultSets=True
(http://msdn.microsoft.com/en-us/library/h32h3abf(v=vs.110).aspx)
Would it be better to open a new form from the same application?
dim frm as ShowCar_Form
frm.Show
I have an access database and a report in that database. I am using the access.application comobject to gain access to access, i.e.
$db = New-Object -ComObject Access.Application
$db.OpenCurrentDatabase("foo.accdb")
This works fine. However, as suggested in another similar question I am unable to get the report out of the db by using the DoCmd.OutputTo method.
$db.DoCmd.OutputTo(3,"The_Report","acFormatPDF","C:\The_Report.PDF")
When I execute that above command, and error returns stating that:
Exception calling "OutputTo" with "4" argument(s): 'The format in which you are attempting to output the current object is not available."
I have ensured that the "save to pdf" add-on is installed. Beyond that, I am unable to figure out what is stopping this object from being output in the requested format. Am I missing something?
acFormatPDF is a constant, so putting the constant name in quotes seems wrong. I tried without the quotes, but Powershell doesn't appear to recognize the constant. So I tried the string value for that constant, in quotes, and it worked.
I'm basically lost with this Powershell thing, but suggest you try:
$db.DoCmd.OutputTo(3,"The_Report","PDF Format (*.pdf)","C:\The_Report.PDF")
Some users get the following error when running reports.
• Execution 'iwy2vpzo52pmp555ftfn4455' cannot be found (rsExecutionNotFound)
They run fine in the morning.
Any suggestions?
Thank you
I can help.
The problem is that the ReportViewer control uses Session to store the currently executing report. Once you navigate away from the reports, the item still remains and eventually loses its "execution context", which is the way Report Server caches reports.
Therefore, before browsing a report, you should attempt to clear out the Session of these reports, so that there are NO cached reports in the Session, and the ReportViewer control can work properly.
You will also find that sometimes when accessing Session.Keys.Count, this error can occur, as again, the execution context has failed.
Make sure you do this on the page showing the report!!
The 2 options are:
if (!IsPostBack)
{
HttpContext.Current.Session.Clear();
ReportViewer1.ServerReport.ReportServerUrl = new Uri(ReportServerUrl, System.UriKind.Absolute);
ReportViewer1.ServerReport.ReportPath = ReportPath;
System.Collections.Generic.List<ReportParameter> parameters = new System.Collections.Generic.List<ReportParameter>();
....
ReportViewer1.ServerReport.SetParameters(parameters);
ReportViewer1.ServerReport.Refresh();
}
Or
for (int i = 0; i < HttpContext.Current.Session.Keys.Count; )
{
if (HttpContext.Current.Session[i].ToString() == "Microsoft.Reporting.WebForms.ReportHierarchy")
HttpContext.Current.Session.RemoveAt(i);
else
i++;
}
I am using SSRS 2017 and was running into this issue when trying to load a report into my MVC project using URL Access. The issue for me had to do with session.
To check this for yourself, you can try deleting the RSExecutionSession cookie and reload your report. Unfortunately, this is only a temporarily fix.
If this does work, try adding rs:ClearSession=true to your query string.
You can read about this setting here.
Look for a trailing space on the report path. This was the cause for me.
On the web.config's impersonation, use identity
impersonate="true"
userName="xxxxx"
password="xxxxx"
instead of : !--<identity impersonate="true"
Hope it helps
If you're running SQL Server Express edition, the SQL Server Agent isn't running to clean up your old SSRS sessions. You'll need to run a job on SSRS DB to clean up the old sessions.
My report took 10 seconds to run and 2 seconds to export - so it wasn't to do with the session expiry length.
I'd get the error when exporting a report to excel into my app an hour after I exported the report.
This error was causing my application to display a run time error.
I added this to the Global.asax class to resolve the error. Tried Server.Clear but got nothing. Session.Clear got rid of the error completely.
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
If ex.InnerException IsNot Nothing Then
If ex.InnerException.ToString.Contains("The report execution") AndAlso
ex.InnerException.ToString.Contains("rsExecutionNotFound") Then
Session.Clear()
Return
End If
End If
End Sub
While it may not be 100% applicable to the question above, I haven't been able to find any other resolution.