I have a report embedded in an ASP.NET page. The ASP.NET page has some checkboxes that the user can select which datapoints they want to have show up in the report.
In the code behind file I am setting up part of the WHERE clause to be used in the query based on which checkboxes are checked.
I am putting this string into a report parameter and am not sure how to implement that parameter in the query. Simply placing the parameter in the query thinking the value of the string would come across does not work. I have the correct syntax in the string that is being passed into the report.
How do I properly use a Report Parameter to alter the WHERE Clause of the query?
I am using SQL Server 2005.
Base the report on a stored procedure that takes a BIT parameter for each of the checkbox values.
Build the dynamic SQL in the stored procedure and execute it.
Related
I'm currently working on generating a set of reports and dashboards based on a set of data within our mysql database.
I've created a few custom procedures that take a date input and give all the results as required.
Unfortunately, when I point to these procedures within "data sources", I'm unable to dynamically change the Date parameter - once I set it within Data Source, it's stuck as that date forever (unless I edit the report/dashboard).
Does anyone know of any way you can change the query based on a users input?
I've tried creating parameters which match the name of the parameter set within the query at "Data Source", but have been unable to "inject" the date to use.
Any help would be greatly appreciated!
Check the "Filter a SQL Query" section of this documentation topic https://docs.devexpress.com/ReportServer/118944/create-dashboards/add-a-dashboard-parameter-and-filter-data
Briefly, you need to create a dashboard/report parameter and bound it to the data source's query parameter via expression.
In Asp.net using Visual Basic code I want to be able to query a database after a user inputs search criteria, get the results and display them in a table, with the ability of the user to click/select individual results and delete the corresponding data from the database. How can I do this?
You can do this by utilizing a Datagridview and binding data to it (by using OLEDB for example). Use the WHERE clause in your query to filter the records, based on the user input. (http://www.w3schools.com/sql/sql_where.asp)
The Datagrid has events you can use (delete, select, insert and update event).
See for more information: https://code.msdn.microsoft.com/VBASPNETGridView-19039173
Good luck!
I was given a report today with a normal embedded data set (dataset1) and data source (datasource1) but the data set query is just a number: '1411'. The previous programer manually entered fields (not calculated fields) into the field tab.
When I click RUN, it works.
How is it populating the page without a proper query?
-There is only 1 tablix called (table1.) It also is pointing to dataset1.
-In Report Properties there is no VB code.
-RDL XML: Under dataset1's tag:
<DataSourceName>datasource1</DataSourceName>
<CommandText>=1411</CommandText>
I see no other SQL listed. Could there be something else on the server that's triggering it?
What sort of data source is "datasource1"?
If it's an RDBMS, check if there is a stored procedure or function in the database with the name "1411".
In SQL Server for example you could conceivably have a stored procedure called [1411] that returned a data set.
I'm assuming we are talking RDL (Report Definition Language). You might open this report with your favorite text editor and look at the CommandText XML tag to find the associated query. Hope that helps.
Hi i have a sql database server runnin on my desktop. I want to create an asp.net application to detect when new data has been inserted into the database. Is there a command in visual studio to detect when theres new data right away?
Use the timestamp datatype on each column. This will stay identical until a change is made to any column in that row. If you combine this with the rowcount you can be certain if anything has changed in your database. You would need to cache the current timestamps and row count and compare them with the results of a query, you can then find out if there is a change.
So in your answer to:
Is there a command in visual studio to
detect when theres new data right
away?
Yes there is, although its not a command is the timestamp function (not to be confused with anything to do with the time)
Perhaps you need to provide more details to your scenario since constant querying of the database might not be the best way forward.
You can get a row count of your dataset and create a application
IN VB
Dim i as Integer
i=dataset.tables("table").rows.count
in sql backed return a count of a table and create a ASP.Net website to get the count and when count change alerts you
It may be heavier duty than you are looking for, but SQL Notification Services will do what you want. Essentially you execute a query and tell notification services you want to be notified whenever re-running that query would produce different results.
if you are using caching you can make it dependent on sql.
or you can fire email using sql trigger so when ever trigger get fired you will receive an email.
otherwise you will have to check your db again and again for any changes.
if you can provide more details about exact situation , we can provide more specific solution
You can create a webservice and call it using javascript.
here you can find sample how to call webservice using javascript:
function CallWebservice()
{
myWebService.isPrimeNumberWebService.callService(isPrimeNumberResult, "IsPrime",
testValue.value);
setTimeout("CallWebservice()",100);//here set time according to your requirement
}
For timer in javascript:
http://dotnetacademy.blogspot.com/2010/09/timer-in-javascript.html
For webservice in javaScript:
http://www.webreference.com/js/tips/020715.html
How to call webservice in JavaScript for FireFox 3.0
I am trying to populate an SSRS parameter's ValidValues property at run-time without writing custom stored procedures. The issue is that the available values for a certain parameter change depending on a user's security level. I'd like to keep the logic for it in the code rather than in stored procedures. Is there a way to populated ValidValues for ReportParameters in .NET for SSRS?
have you tried creating a data set (either a select statement or sp) to pull the possible values? you can then set the parameter to use the data set.