how to use .rdlc parameter in report's query? - sql

I'm passing a parameter to my .rdlc file, which is working properly. What I can't figure out is how to then use that parameter in the query the reports dataset uses. How can I use this parameter in the query?
I'm designing it in Visual Studio 2008. If there is some other method I'm not aware of, please suggest that also. I want to keep the report as un-coupled with the program as possible so I can reuse it.

The only answer I can find is that this is not how reporting services works. You must give it a dataset at runtime which has the same schema as the dataset used at design time.
I was expecting (and hoping for) a similar behavior to Crystal Reports, where you can open a stand-alone report file and be prompted for parameters, and then embed that same report into an application and pass it parameters programatically. Reports are more portable that way, but if its not possible...

Related

how to visually design reports generated by dossier?

I have used dossier to generate reports in my application. Now I want to visually design my reports generated by dossier like charts. Is there any gem available to do that? Can you please any one help me (or) tell me to how to use iReport in rails application.
Dossier currently does not provide any visualizations (though that would be a nice enhancement). I have been using to to power various JS charting libraries using JSON. Any report can be converted to JSON format by adding a ".json" extension to the report url. Generally I have found that I will have to alter the way I write the sequel selects slightly to get the right JSON output, but overall have had good success with this strategy.
Let me know if I can answer any other questions on this.
Thanks!

Creating RDLC reports dynamically w/o XML editing

Most would suggest using one of the many XML editors to create a customized RDLC XML, according to user selections, and passing that report to Microsoft's Report Viewer object. I currently implement this method in previous version of my code. However, it is messy, long and lacks eloquence to say the least.
Previous research, I can't remember exactly where I saw it, has led me to believe there is a method to create a data-set, dynamically through code, create an adapter to fill the data-set, and then have that dataset.writeXML() to produce a fully functional copy of XML that can be passed to the Microsoft Report Viewer object.
Again to clarify, I do not want to use XML classes to write my report up. I want to build my dataset through code depending on user selection, have the dataset write out the XML and then pass that to the Reporting object.
A lot of the stuff I've found favors ASP.NET for some reason and I have yet to fully verse myself in its workings.
It seems that what I'm trying to do is write out the RDL (Report Definition Language). This RDL is a set of tags that the Microsoft Report Viewer interprets in order to produce a viewable object to the end user. A data-set is an element of that RDL definition so it really can't produce the RDL itself. Kind of like a baby giving birth to a mama. Here are some excellent resources I found that shed insight into the elements of an RDL file.
Here

Cystal reports with Linq2Sql

I want to use Linq2Sql as the data source for my Crystal reports. I have all my data in my domain objects in the form of Lists. The problem is all my domain model resides in a different namespace in the form of a .dll. And when i try to assign a data source for my report in Database Expert window, under .NET Objects, i can only see classes that are available in the current project and not from other projects in my solution, nor from other namespaces.
Any solution or ideas how to deal with it
It's been a while since I've done this, but try adding a static method that returns a List of the objects you want to use in the report, in a class that's contained in the same project as your report.

How to determine where, or if, a variable is used in an SSIS package

I've inherited a collection of largely undocumented ssis packages. The entry point package (ie: the one that forks off in a variety of directions to call other packages) defines a number of variables. I would like to know how these variables are being used, but there doesn't seem to be an equivalent of "right click/Find All References"
Is there a reliable way to determine where these variables are being used?
A hackish way would be to open the dtsx file in a text editor/xml viewer and search for the variable name.
If it's being used in expressions, it should show it and you can trace the xml tree back up until you find the object it's being used on.
You can use the bids helper add-in thats gives you visual feedback on where variables are used in your package. Thats makes it very fast and easy to detect them.Besides that, it offers several other valueable features.
Check out: http://bidshelper.codeplex.com/

Include sql scripts in a VB6 application

I am maintaining an old VB6 application, and would like to include SQL scripts directly in part of the project. The VB6 application should then extract the text of this script and execute it on the server.
The reasons for this approach are various - among others, we want to deliver only an updated executable rather than a complete update/installation package. Hence, the SQL scripts need to be compiled into the application just like a resource file. And, obviously, one has to be able to get at the content from code, in order to send it to the database server.
Does anyone have a good way to do this?
The simplest solution is to just create a VB module with the scripts as strings.
If you want to use a resource file instead, you can do that too. You can associate a resfile with a VB project (I don't remember how to do this directly in the VB IDE but the VBP file supports a ResFile32 parameter).
EDIT: It seems like the issue here is mostly about formatting -- you don't want to store SQL queries as one long string, but formatting the query nicely inside VB is tedious because you have to add quotes, add string concatenation operators to join the lines together, etc.
I would recommend placing the SQL in a text file and formatting it in whatever way you like. Write a script that will take the text and convert it into a VB module. The build process would be modified to always apply this script first before compiling the application.
For scripting, use your favorite scripting language; if you don't have a favorite scripting language, this is an easy enough task that you could do it in VB, C#, or any other language. If it were me, I'd probably use awk (gawk) or Python.
If you want to use a resource (.RES) to store your SQL, go to the menu:
Add-ins > Add-in Manager...
and select VB 6 Resource Editor. Configure the add-in to be loaded and to load at startup.
From the editor add-in, VB provides a simple interface to add resource strings. You will refer to these using the provided constant values. To load the strings at runtime, use the LoadResString function:
Public Const SQL_INSERT As Integer = 101
Dim strSQL As String
strSQL = LoadResString(SQL_INSERT)
(replace "101" with the constant value of the string you wish to load)
Just another thought on your approach. Because I find myself tweaking the program's behavior or UI for customers I might be in the middle of a change that either is not ready or has not yet been tested and approved. So if I have properties that change from time to time, but I want to maintain control of, for instance connection settings to our ftp server, I will create a resource only dll exposing my properties and use a resource file in the dll to supply the values. When my network manager changes something on the ftp server I change the strings in the resource maanger, recompile the dll and release just the updated dll. I'm sure there are many more solutions, but that is how I do it. If you don't think you might have to change your SQL scripts at the same time you are changing you exe this probably only complicates your work. It has worked well enough for me that now this is pretty much standard for me.