Create a shared datasource in VS2012 for SSRS - reporting-services

I'm just looking to create a shared datasource in VS2012 without selecting an entire database scheme. We'll mostly put doing all the dataset queries by sql query.
I found this but i'm still unable to create a shared datasource.
http://msdn.microsoft.com/en-us/library/ms159165.aspx
For an embedded data source, verify that Embedded connection is selected. Does not exists.
So how do you create a shared datasource in VS2012 with just a connection string?

A DataSource is just a connection string in an element in an xml structure as far as SSRS is concerned. A shared one is just one kept as it's own object and then the rdl elements(reports) have a reference in their xml to that object. Think of an rds file (data source for SSRS) as this very similar to .NET standard connection strings:
Data Source=(server);Initial Catalog=(database)
Plus you can store credentials to mock who is running the report. Thus you can make a proxy user to run the database connection. However SSRS does this through a GUI called 'Business Intelligence Development Studio' it is an add on to Visual Studio that is generally SQL Server version matches that VS version EXCEPT FOR 2012. That one creates a shell Visual Studio of VS 2010 just meant for BIDS.
To my knowledge you should be creating these directly in BIDS and not try to hack the RDS file directly unless you get the ReportService2010.asmx web service to mess with it's properties in .NET (which is a lot more work.).
To add one you just do this:
Go into BIDS with a report project
Expand a project
Right Click 'Shared Data Sources'> 'Add New'
Click 'Edit...' next to connection string
You get a menu very similar to ADO.NET standard connection string creator
Put in ServerName
Put in DatabaseName
8*** Optional put in default credentials.
Click OK
Generally SSRS has three parts to everything it does
Datasource = connection string (rds file when not embedded)
Dataset = select query or proc results or other data source return (rsd file when not embedded)
Report = resultant xml display of elements such as parameters, tables, matrices, etc. (RDL file when working on hosted report)
Generally reports can have everything embedded or else just reference everything they use. References are often easier for deployments sake as SSRS is designed to look if DataSources first exist and NOT OVERWRITE them by default. Thus if you reuse a datasource it is much easier in the long run as long as policy for it is set up correct.
If you want to just know the structure of an rds file they look like this:
<?xml version="1.0" encoding="utf-8"?>
<RptDataSource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Name="Test">
<ConnectionProperties>
<Extension>SQL</Extension>
<ConnectString>Data Source=TestServer;Initial Catalog=TestDatabase</ConnectString>
</ConnectionProperties>
<DataSourceID>45be0ac1-80a8-4d5c-906b-c13b03298e0a</DataSourceID>
</RptDataSource>

Related

How do I amend shared data source definitions after SSRS migration to a diff node?

Do not seem to be able to find any place in the portal or Report Builder where I can actually edit the connect string & creds.
Report Manager shows the XML, but that really is it.
Disk files (from the looks of it) are no longer present in high versions (using SQL 2016/2017).
Is there a known location anywhere in GUI, or maybe direct edits in the SQL Server repository?
I can't even delete a shared source anymore, only view or test the connection.
If anybody could post a screenshot, it'll be highly appreciated.
EDIT: Just found out - when I create a new Data Source, it's editable; the imported data sources are not.
There are two ways of doing this. You can set the 'overwrite datasource' option in the project properties.
Or, you can got to the report portal , show hidden items in the view menu and there is a folder called "data sources". Open this and you will see all data sources, from there you can edit and save changes. All reports that use that datasource will be affected.

Using external assembly's method's results as a dataset

Using SQL2008R2:
I am trying to create a dataset that is simply the result of an external assembly's return method(s), but everything I can find regarding using custom/external assemblies just has a textbox's value set to the external assembly's method's result via an expression.
I simply want Report Server to do the data processing in the external assembly and bind that result to a very simple report.
I found some references to something about MDX but they seem to be a few years outdated and needed to know if this is possible.
Assuming you already have a .dll - Place your dll in the report designer folder (where your RDL is) and the report server folder, somewhere around here:
Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies
Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer\bin
Now add a reference to your dll from your report.
With your report open go to Report, Report Properties, References, Add reference, browse to your dll and add it.
Now in a text box properties Value call a method of your dll. It should look something like this:
=MyDllName.ClassName.MyMethodOrSubOrWhatever
This is a great article that can walk you through this:
Assuming you already have a .dll - Place your dll in the report designer folder (where your RDL is) and the report server folder, somewhere around here:
Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies
Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer\bin
Now add a reference to your dll from your report.
With your report open go to Report, Report Properties, References, Add reference, browse to your dll and add it.
Now in a text box properties Value call a method of your dll. It should look something like this:
=MyDllName.ClassName.MyMethodOrSubOrWhatever
This is a great article that can walk you through this: http://support.microsoft.com/kb/920769
P.S. Another option, if you don't want the web server doing the heavy lifting, is to use stored procedures. However, in our experience with very large database systems, it is much easier to scale up the web servers than it is to scale up the database servers so we do much of the heavy lifting on the web servers.
If you need a data set that is generated by custom .NET code, you can either set up a web service (here's a good tutorial), or you can set up a custom "data processing extension".
A data processing extension will allow you to choose a new data source in the SSRS report designer, and this data source will run custom .NET code. The full description is on MSDN, but here are the basic steps:
Create a new class library project
Implement all of the required extensions (and any desired optional ones)
Copy the DLL to the SSRS bin folder
Edit the SSRS config file to register your extension (by specifying the fully qualified name of your IDbConnection class)
You can find working examples from both CodePlex and Microsoft.

Report model data

I'm working on ssrs 2008 r2 and from it, I'm building a report model using a relational database as a source.
I have many databases and all of them have the sames structure (same tables and same table fields).
from the first look on report model,all entities are generated from the data source view. Consequently, it doesn't allow for one report model to be used with multiple database.
Is there anyway to use the same report model for multiple databases ?
Ps: my report model has so many entities, for each one, I have to edit it.so you can see that what I need is to automate the process.
I was keen to see answers for this question since I have this same requirements for product I've inherited. But since you've not had any other answers perhaps this will help if I describe the setup we have.
Initial Deployment
Locally we have one Visual Studio 2008 (BIDS) Report Model project which contains one data source, and a number of data source views and reporting models. Each time a new database goes online, we change the connection string of the data source and update the deployment configuration of the project to target a different report server folder following the format /Models/<databaseName>. The model is then deployed using BIDS. The frequency of this is low, only happening once every couple of months. If we had to setup for lots database all at the same time this would be a slow and painful process. As a side note we limit access to each deployed model by configuring the security of each reporting folder i.e. the <databaseName> folder.
Model Updates
Since our initial deployment is manual, updating the model in the same way would be very painful. So I wrote a tool which makes use of the web services provided by SSRS to refresh our deployed models. At a high level this how this works; after changes are made to the report model found in BIDS project (remember we only have one project and not one for each deployed model) the tool loops for each database and calls the SetModelDefinition web service method passing in our updated model file. We're not changing the data source so the updated models on the report server will continue to use its configured data source. Again this only works because the data source name isn't changed per database.
For reference here's example C# code of what the tool does to bulk upload the model
// prepare the model for upload
string pathToSmdlFile = "c:\ReportModel.smdl";
string pathToDataSourceViewFile = "c:\ReportModel.dsv";
string semanticModel = System.IO.File.ReadAllText(pathToSmdlFile);
string dataSourceView = System.IO.File.ReadAllText(pathToDataSourceViewFile);
// combine the semanticModel and dataSourceView, BIDS does when you use the `deploy` action
// because we're doing this in code we have to combine
byte[] model = Encoding.UTF8.GetBytes(semanticModel.Replace("</SemanticModel>", dataSourceView + "\n</SemanticModel>"));
// upload model using web service
using (var rs = new ReportingService2005WS.ReportingService2005())
{
rs.Url = "http://yourserver/ReportServer/ReportService2005.asmx";
rs.Credentials = new System.Net.NetworkCredential("admin", "password");
foreach (string databaseName in GetDatabaseNames())
{
string fullpath = string.Format("/Models/{0}/ReportModel", databaseName);
rs.SetModelDefinition(fullpath, model);
}
}
I'm not saying this is the perfect setup - I actually think I should be possible to upload the reporting model once and have something change the data source at the point that the report is used. Perhaps its possible to configure the use of different data sources depending on the SSRS login used. Failing that the report itself should somehow pass the details of the correct data source to use (or connection string). On the flip side this does mean that our users don't have to know the details of the connection to the database. We just give them SSRS logins and allow them to build with report builder; because of the security applied to each database folder they are restricted to there database...

Using a shared data source for dynamically generated and deployed reports

I'm dynamically generating RDL files for SSRS 2008, assembling my reports from "building blocks" which I defined as reports on Report Server, and which I use as subreports on my generated report.
On my Report Server, I have a single, shared data source which does work as long as I run stuff directly on the report server.
What I'm trying to accomplish is this:
my generated main report should reference that shared data source
my subreports contained on the generated main report should also use the same data source
after I deploy the report to report server using the webservice interface, I'd like to be able to actually see the report right away
For now, I can generate and validate my RDL just fine, I can deploy it to the report server just fine, too - it shows up and all, great.
But when I try to view the report, I get an error that my data source is invalid or has been removed or something.......
What am I missing?? I am pretty sure I have the right data source - GUID for it and all - and the names do match. How do I tell a generated RDL to use the shared data source already present on the server??
Answering my own question here, hoping someone else might find this useful:
I was under the (false) impression that the unique "DataSourceID" given to a data source on the server would be sufficient to identify it uniquely.
So in my generated RDL, I had something like :
<DataSources>
<DataSource Name="MyDataSource">
<Transaction>true</Transaction>
<DataSourceReference>MyDataSource</DataSourceReference>
<rd:DataSourceID>6ba7c588-e270-4de9-988c-d2af024f10e1</rd:DataSourceID>
<rd:SecurityType>None</rd:SecurityType>
</DataSource>
</DataSources>
Now this worked once, when my data source was indeed called "MyDataSource" and located in the same directory as my report which I published through the RS WebService API.
As soon as I moved the data source elsewhere, it stopped working.
THE SOLUTION:
This may sound silly, but I really didn't "get it" at first: the DataSourceReference needs to have the full and complete "path" on the Reporting Server to that data source I want to reference. Just specifying the unique ID won't do....
So once I changed my RDL to:
<DataSources>
<DataSource Name="MyDataSource">
<Transaction>true</Transaction>
<DataSourceReference>/MyProject/DataSources/MyDataSource</DataSourceReference>
<rd:DataSourceID>6ba7c588-e270-4de9-988c-d2af024f10e1</rd:DataSourceID>
<rd:SecurityType>None</rd:SecurityType>
</DataSource>
</DataSources>
(notice the <DataSourceReference>/MyProject/DataSources/MyDataSource</DataSourceReference>)
since that moment it works like a charm.
Hope someone might find this useful some day!

textboxes in Datarepeater dynamically 'databound'

I need to know if it is possible to dynamically bind a textbox residing within a datarepeater to a 'dynamically' created BindingSource. I am using VB.net. The database I am using is a MySQL database.
I have to use the connection dynamically due to the fact that the database my not permanently reside on the same server.
[edit]
ok, so it seams that I am a dolt when asking questions. The app that I am making is not web based. it is a simple (I hope) app that connects to a MySQL database, accesses a table so I can edit/view it. Current setup is using the Add DataSource wizard. I have successfully connected to the dbase dynamically using the mysql connector dll but without the textboxes set at design time to a datasource, I am unsure on how to 'link' them via the datarepeater.
Your connection string should be defined in your Web.Config, and if you move your database to a different server, it's just a matter of modifying the web.config entry. As long as you keep the connection string name the same, the BindingSource object will pick up the new value from the config.edit
In truth, the same concept should apply here as it does in the web app answer listed above.
All of your data objects should be hard-coded, and it's just the connection string (which you'll have to either ask the user for, or push out as update when the DB moves) which will get modified.
For example, create a App.Config file in your project. Have one of your configuration values be the connection string. This config value will be where you go to get the connection string whenever you need it. Then your wizard will be there to allow users to easily modify the connection.
then look in app.config
the conenction string should be there.
If it is not then you should put it in here as you can change this file at any time and not have to recompile your app.