This is frustrating me to no end. I need to create a report based off a SQL query to be displayed in a report viewer on an asp page. Seems like it would be simple but I can't seem ti find an example of how to accomplish this. I don't need a stored procedure I need something I can add variables to like stringbuilder. The user will give an input and then the report will populate based off the query that the input was passed too. Simple seems like but anything dealing with a report seems to want the wizard. What can I do to get a report that looks good and I can use a sql query to bind data to? Thank you in advance.
You can use Gridview to display table from a database. A good start can be read here and here.
Please give us some additional info on what you need so that we can able to help more. :)
Related
I have a database running in SQL server that I can edit/add/ retrieve information from with no worries. I just have a question about the best way to lay out the database in this situation.
Say I have a database stored with the columns
Score, DateTime, Comment
but when I want to display the table to the user I want them to see a table that has
Ranking (just 1-25 or so), Score, Time Since, Comment
What is the best tool to use in visual studio to achieve this?
I have been trying to use GridView which I figured made sense but I have trouble creating the ranking column and the time since column. What is the best way to achieve this?
Also when I adjust some algorithm to sort the comments by score and time since, where do I put this? In the C# or is there some way to incorporate this into the database?
Thanks a lot for the help!!
EDIT: It's an ASP.NET web form application
Use SSRS (Reporting Service) and use the TOP filter in your grid.
I have a program which analyses some information in runtime and save the analysis results in certain variables. I have 15 of these variables, of which, 13 are string type, 1 integer and 1 bitmap image. I want to let the user to generate a report based on the analysis data. I have been trying to search the forums for help, but couldn't find a proper solution yet.
First of all, I don't want to save these analysed results in a database (SQL etc). All i want to do is just to display the report to the user based on analysis results and let him save or print it.
This is what I did so far based on numerous hints that I get from forums. I added a report.rdlc file and created a template for the report. I also created a dataset.xsd file and added the analysis parameters to the dataset. All the dataset values are added to the report template.
Now this is where I am stuck. I don't have an idea how to proceed from here and generate a report. Right now what my program does is, upon button click, the analysed parameters will be saved in their respective variables that I specified in the main program. What I want to achieve is to use these results and generate a report as in the template. Sorry that I am not able to post images here due to the user restriction.
Any guidance on how to achieve this is much appreciated.
Thank you!
From what I recall, reports support parameters which can be injected via the presentation control.
With little else to go on, I would look here first.
Hi good people at StackOverFlow,
This morning I have found myself having a few issues with getting the correct results when attempting to view reports in my C# application using Crystal Reporting.
I'm attempting to build reports based on a user's entry when selecting an 'Employee Number' from a drop-down list within my application, so far Iv'e got the drop-down list populated with the database column records but I just cannot find a way to build a report when users select an option.
Please could someone give me an insight on how this is done or even direct me into the right place to learn how to perform such an action, I'm here to learn and would rather find my way around this issue as a means to gain knowledge rather than just simply asking for a user to fix my problem...
Thanks people!
Create your report in design with your whole table to be displayed. Then you can either create a parameter in crystal reports to filter the value by your selected value from combo box or you can set your query while loading the report with the Filtered query.
eg:
string query = String.Concat("Select * from wharever where something like ",yourcombobox.text);
Then set this query as the query to produce the report.
I'm quite busy reading different posts over how to create reports from dynamic queries. I have the next problem and maybe someone here can help me with this:
I have a class where I can create a dataGridView from a dynamic dataTable in a project made with C# from VS 2010. I populate my DataTable with one of 9 different linq queries that I have according to the user requirements, which also are saved in a register in my database. Starting from this point, I need to make a report where I can show of the same way the data selected.
I have found the code from the website got ReportViewer and it works quite good. Only I have a last problem. I need my report to show a chart according to the parameters passed via the DataTable. I saw the examples that they have there for the charts but they work quite restrict with what I need, and the code for the chart generator that is incluided in the Dynamic Table project is quite extense and a bit complex for a beginner like me.
Do you know any other examples that maybe I can find to use to make the code in my project? Many thanks in advance :).
I found another way to do it:
Now I'm using classes as datasources and filling arrays of these classes with the contect of the datatable.
I pass these arrays as my datasources for the project.
I group my data by the number of fields I want to display and then I choose between pre made .rdlc files where I show my data to the user.
I have an email address in a sql table in the following format:
clerk#weavers.org.uk
How can I convert it to the proper format?
I see it displays perfectly on a webpage but anywhere else it's like this. I am assuming it's codes for alphabets etc. (html) which get converted, but how do I update my table with the proper emails?
Thank you.
Take a look at the HttpServerUtility.HtmlDecode method, you should be able to write a loop to process all your data or write an extended stored procedure and call it from SQL.
If it's a small amount - you can use a tool like this: http://www.web2generators.com/html/entities
You can use the information found at http://www.lookuptables.com/ to write code to decode it yourself, or like Tony has suggested; use HttpServerUtility.HtmlDecode
I don't know of any good way to do this in with SQL - I'd write a small app to process the data.
If you're looking for a one-time fix for this one record: As you say it displays correctly on the screen, then cool: Display it on whatever screen that is, then copy and paste that value back into a database update, either a screen or a one-shot query.
If you're software is putting these escapes into the email address before saving to the database, I'd say: Don't. This is a bad idea, because then you can't search it or manipulate it. Store all values in "real" text. Do your HTML escaping when you are laying out a screen. Actually in ASP.NET I think most of the display functions do this automatically; some have flags to tell it to NOT HTML escape.
Addendum: I see Tony's answer assumes all your email addresses look like this. Is this correct, or is it just one? If it's all, then my suggestion for fixing one is impractical, you do indeed want to write a little program that loops through the db and fixes them all with HtmlDecode.