so that everything is then driven from a single selected Quarter value, the table report no longer gets populated, as it has hardcoded field values such as
joy mundy alluded in her webcast that it is possible to dynamically specify a table name in a parameterized ole db source query. is this true? if so, how can it be done?
I have a class that works fine using the SQLDataReader but when I try and duplicate the process using a Dataset instead of a SQLDataReader it returnsa a null value. This is the code for the Method to return a datareader
public SqlDataReader GetOrgID() { Singleton s1 = Singleton.Instance(); Guid uuid; uuid = new Guid(s1.User_id); SqlConnection con = new SqlConnection(conString); string selectString = "Select OrgID From aspnet_OrgNames Where UserID = @UserID"; SqlCommand cmd = new SqlCommand(selectString, con); cmd.Parameters.Add("@UserID", SqlDbType.UniqueIdentifier, 16).Value = uuid;
SqlDataAdapter adapter = new SqlDataAdapter(); adapter.SelectCommand = cmd;
adapter.Fill(dataset); return dataset;
}
Assume that the conString is set to a valid connection string. The Singlton passes the userid in from some code in the code behind page ...this functionality works as well. So assume that the Guid is a valid entry..I should return a valid dataset but its null.
Hello, I have been reading about how you shouldn't build dynamic SQL statements (see TextBox1.Text in line 3) and should use parameters instead, but I haven't yet found how to create a SELECT statement with a parameter that fills a dataset. If anyone can show me the correct way of doing this I would appreciate it so I can add it to my code snippets for proper coding practices. Thanks in advance for any assistance. string strConnectionString = ConfigurationManager.ConnectionStrings["sqlConnectionString"].ConnectionString; SqlConnection myConnection = new SqlConnection(strConnectionString); -> string sqlSelect = "select * from customers where city = " + "'" + TextBox1.Text + "'"; SqlDataAdapter da = new SqlDataAdapter(sqlSelect, myConnection); DataSet ds = new DataSet(); myConnection.Open(); da.Fill(ds, "myDataset"); myConnection.Close();
I found out the data I need for my SQL Report is already defined in a dynamic dataset on another web service. Is there a way to use web services to call another web service to get the dataset I need to generate a report? Examples would help if you have any, thanks for looking
This fails with the error "cannot convert varchar to numeric". I believe since ColumnA is numeric, its trying to convert the dynamic paramter to numeric leading to the failure.
has someone implemented an In clause as a parameter? Please do not tell me that I can append the values as string and construct a dynamic query. I want to use a parameterized version. I will be calling this repeatedly and dont want recompile overhead.
I have a dataset that when run returns 270 rows. The table using the dataset in the report only prints the first row. I have the table grouped by a status type, but this is for when I can get multi-select paramenters installed and working. For now I just need the report to print all the returned rows. Help!!
I'm trying to create an interface for filtering profiles from an SQLServer 2005 database using an html form. The form allows filtering based on a minimum level required in between one and four different columns. The first (and only mandatory) column to be filtered on has its name hard-coded into the base query. In trying to get the other three possible criteria to work, I've taken several approaches, all of which failed.The other three potential criteria are selected from a drop down menu on the form and ideally these choices are passed into a query to be used as column names. My first attempt looked like this: query = "SELECT * FROM profiles_tbl WHERE (EngSkill >= @english)" .... if ReqSkill1 <> "" then level1 = Convert.ToInt32(Request.form("minskilllvl1")) query = query & pickclmleft & ReqSkill1 & pickclmright1 cmd.Parameters.Add("@ReqSkill1", SqlDBtype.text) cmd.Parameters("@ReqSkill1").value = ReqSkill1 cmd.Parameters.Add("@level1", SqlDBtype.int) cmd.Parameters("@level1").value = level1 end if above If statement was repeated for 2nd and 3rd optionsSecond approach was to remove all parameters from sections of the query that were appended onto the original statement. This involved lots of strings containing AND clauses with hard-coded column names which were appended on when the corresponding option was selected in the form. Code looked like this: query = "SELECT * FROM profiles_tbl WHERE (EngSkill >= @english)" ASPqry = " AND (ASPlevel >= " try con = new SqlConnection() con.ConnectionString = “**************string was correct****************� cmd = new SqlCommand() cmd.Parameters.Add("@english", SqlDBtype.int) cmd.Parameters("@english").value = english if ReqSkill1 <> "" then if ReqSkill1 = "ASPlevel" then query = query + " AND (ASPlevel >= " level1 = Convert.ToInt32(Request.form("minskilllvl1")) if level1 = 0 then query = query + "0)" end if if level1 = 1 then query = query + "1)" end if if level1 = 2 then query = query + "2)" end if if level1 = 3 then query = query + "3)" end if end if end ifFinally when this too failed, I created four entirely separate queries, detected how many criteria were used, and used the appropriate query, passing necessary skill level in as a parameter. I'll provide code if needed here. Queries were written as strings and then used to set the CommandText property for an SqlCommand variable. I think it's important to note that in all cases the most basic version of the query worked. In the first, if only the first criteria was used the statement executed fine. Same in the second. In the third, whatever query could be assigned first (even though only one could be assigned because of logical structure of if statements) worked and none of the others would. This last case was tested even with completely hard-coded queries that SQL Server 2005 validated as correct and would run. Any help is greatly appreciated. Will post as much code as people want/need, and if I can get any one of these methods working I'll be thrilled. I have no need for all three. A.S. Moser
i have a dataset which returns me a dynamic set of data ie. number of columns can be different....say 14 columns for some dates...and just 12 for some other...(pivot table is being used in the backend)...how can i present this in the table...also my column names are best suited to be the column headers in the table.....is it possible to create a table at runtime...??
I have placed one table object to show my datarows in reporting services report. Depending upon the Parameter i want to change the location of this table in report. Is it possible or any other way we can do this. please help on this. The purpose is to show the table horizontally centered after hiding the visibility of some column depending upon the parameter.
Hello all! Does anybody know, if it is possilbe to dynamically change grouping in a table report? I mean, is it possible to provide the enduser the capability to group data in a table on whatever column he would like?
The second question is related: Is it possible to make a usersort on a grouped table, in such way, that ALL the rows would be sorted ascended regardless of the group they belong to? (For now the only way I see to do this is to give the enduser possibility to turn off grouping manually)
I am trying to render a report that I set up with SSRS 2005 from an existing .Net web application. The report takes in a multi-valued parameter (sequenceNums) and displays data accordingly.
This is the url I am passing from the web application:
Upon redirect, I receive the following error "one or more data sources is missing credentials"
I currently have the following connection settings checked for the DataSource used in the report: - connect using credentials supplied by the user running the report - use as windows credentials when connecting to the DataSource
When I attempt to view the report with no parameters being passed in, the report renders properly and I receive a prompt asking me for my credentials.
Do I have to connect to my DataSource using credentials stored securely on the report server?
Thanks in advance.
Sam
ps - i included the url within a code block so no smiley faces would show
What is required is to split data of this format into 3 separate datasets:
1. One dataset for DividendRequirement of 100, i.e. select * from tableName where DividendRequirement = 100
2. One dataset for DividendRequirement > 100 i.e. select * from tableName where DividendRequirement > 100
3. One dataset for DividendRequirement < 100 i.e. select * from tableName where DividendRequirement < 100
I know that i can do it with 3 separate stored procedures using a different operator ('=', '>' and '<') in each one and that i can combine the 3 stored procedures into 1 using dynamic sql and pass the operator (or some number that maps to a particular identifier) as a parameter to the stored procedure. What i'm after though is a way to avoid dynamic SQL but still keep it as one stored procedure. Possibly some clever use of case statements or something along those lines?
hi i have a problem i am writing a stored procedure which contains "EXECUTE" statment which excutes the query and retrieves the attributes what i want. by using that procedure it is working fine and i am able to get the result
but i am not able to build the report why because this dataset not listing the attributes.
my procedure is like this : -------------------------------------------- USE [HOST_BPM_COVLTCP] GO
SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO
ALTER PROC [dbo].[PB_Report_GetProjectAttributes] @intProjectId INT AS BEGIN
SELECT @SRC_ATTRIBUTE_COLUMNS = (CASE WHEN @SRC_ATTRIBUTE_COLUMNS IS NULL THEN '' ELSE ',' + @SRC_ATTRIBUTE_COLUMNS END), @STR_ATTRIBUTES = ISNULL(@STR_ATTRIBUTES, ''''' DUMMY_COL'), @SRC_ATRIBUTE_NAMES = ISNULL(@SRC_ATRIBUTE_NAMES, ' '''' WHERE 1 <> 1')
EXEC ( ' SELECT DP.IDX PROJECT_ID, dbo.FindAndReplace(DP.CODE) [Project Code], dbo.FindAndReplace(DP.NAME) [Project Name], dbo.FindAndReplace(DP.LABEL) [Project] ' + @SRC_ATTRIBUTE_COLUMNS + ', ISNULL(DP.CREATED_BY,'''') AS CREATED_BY, ISNULL(DP.MODIFIED_BY,'''') AS MODIFIED_BY, DP.CREATED_DATE, DP.MODIFIED_DATE FROM DIM_PROJECT DP, ( SELECT ' + @STR_ATTRIBUTES + ', PROJECT_ID FROM PB_PROJECT_ATTRIBUTE_VALUE WHERE PROJECT_ID = ' + @intProjectId + ' GROUP BY PROJECT_ID ) SRC WHERE DP.IDX = ' + @intProjectId + ' AND DP.IDX *= SRC.PROJECT_ID ORDER BY DP.LABEL ' ) ---------- actually this procedure should result the following attributes
Hi, I have a need to display on screen AND email a pdf report to email addresses specified at run time, executing the report with a parameter specified by the user. I have looked into data driven subscriptions, but it seems this is based on scheduling. Unfortunately for the majority of the project I will only have access to SQL 2005 Standard Edition (Production system is Enterprise), so I cannot investigate thoroughly.
So, is this possible using data driven subscriptions? Scenario is:
1. User enters parameter used for query, as well as email addresses. 2. Report is generated and displayed on screen. 3. Report is emailed to addresses specified by user.
We have built an analytics solution in Analysis Services with the following setup:
1) FactTable = Customer transactions 2) DimCustomerClassificationTable = For a customer over a trailing twelve month period, we have pre-calculated a series of segmentations such as their revenue segment at a Worldwide Level, Region Level, SubRegion Level, or Country Level, their product classification (e.g., what are they mainly buying) at a Worldwide Level, Region Level, SubRegion Level, or Country Level etc. For each combination of a customer and country over a trailing twelve month period, we have one dimension table record that has their segmentation classifications at each geography level. 3) DimTime = Allows a user to select a trailing twelve month time period 4) DimSalesLocation = the hierarchy of sales organization locations (Worldwide, Region, SubRegion, Country) credited with the sale to the customer
Ideally, we would like to create calculated members on the DimCustomerClassification dimension that would assume the value of the correct segmentation field based on a user's selection (e.g., if they has selected a country, we would have one calculated member called Revenue Segment that assumes the value of Revenue Segment Country, if they selected a SubRegion, it would assume the value of Revenue Segment SubRegion, etc.), but we are not sure if this is possible.
If this isn't possible, what would be the best approach to address this?
I am Creating Click Once Windows Application with Reporting Services 2005.I have created Report and Published on Report Server.In my windows application I am successfully able to view my published report through report viewer control.
Now in my application I am getting a dataset from my custom webservice. I want this dataset data to be added to my report as datasource at runtime on Client Side ,as my report is on Report Server.
I'm a Transact-SQL newbie, and I would like to create a procedure that creates a table with a parameterized name. I wrote the following, which I thought should do the job:
CREATE PROCEDURE procedure_AddFund @FundName varchar(10) AS BEGIN CREATE TABLE @FundName (Date smalldatetime, Price money) END GO
But I am getting the following error in Management Studio:
Msg 102, Level 15, State 1, Procedure procedure_AddFund, Line 5 Incorrect syntax near '@FundName'.
Presumably, I need to convert the @FundName to some appropriate string type. My question is what is the string type, and how do I do the conversion.
Don't know if this is possible or not - Need to produce a report and the main report has a grid in it.
For every row in the main report, in one of the grid fields there are n images. So to do this, I am using a sub-report. But there is a problem with going to the database for every row to fetch images that if the user does a report spanning more than about 6 months, there will be thousands of records each with the potential to have many images and the constant round trips to the db server would probably kill it.
So what I want to achieve is to fetch the dataset in the main report with just one trip to the database and then pass the dataset filtered by a uniqueidentifier to each row of the subreport.
Could someone please let me know if this or something like it is possible and how to go about it?
Is there a way to subscribe SSRS report using dynamic parameters for email and trigger the report from autosys job so that report should generate the exact time the job is triggered.Let me describe, my SSRS report should be triggered on success of one autosys job. i need to send email parameter and time of report schedule from this autosys job.
I have three types of specific reports that i have to create with the input parameters (range) either
1: By date (rdl 1)
2.By Month (rdl 2)
3.By Year (rdl 3)
Is it possible ( or how do I ) to create just one report template ( one rdl) with the three sets of parameters ( hiding/invisible which ever two sets base on user selection) and the output of the report will display the desired type( either by year, month or date).
I ask this because its possible to create a drill down report from year down to date etc in report designer (vs 2005). Not sure if I can create one instead of three rdls and with the 'logic' built within that template.
I am trying to create a stored procedure that will take a text value passed from an application and update a table using the corresponding integer value using a CASE statement. I get the error: Incorrect syntax near the keyword 'SET' when I execute the creation of the SP. What am I missing here? This looks to me like it should work. Here is my code.
CREATE PROCEDURE OfficeMove
-- Add the parameters for the stored procedure here
@UserName nvarchar(10),
@NewLocation nchar(5),
@NewCity nvarchar(250)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
Execute as user = '***'
DELETE FROM [SQLSZD].[SZDDB].dbo.Employee_Office_Assignments
WHERE User_Name = @UserName
INSERT INTO [SQLSZD].[SZDDB].dbo.Employee_Office_Assignments
Is it possible to dynamically refresh the report model of the report builder?
could it even be using code with any of the interfaces?
When we add a table or add a column to the table in database , will the report model get refreshed automatically or do we need to do it externally. If so, can we use any of the objects and write a custom code in VB.
Hi Is it possible create Reporting Svcs (RS) report with coding in .net assigning dataset to it.... how to run RS report with windows form through report viewer I have tried to find a solution but so far, no luck. Anyone have any ideas?
Hi all. Is it possible to create 2 dataset in 1 report in Business Intelligence Project? I tried to make 2 datasets but if I ran the report it occurs an error. It only ran for 1 dataset. any thoughts please.
I have a report that grows horizontally as it contains a matrix. In the header section of the report, I have items such as Title and time stamp in text boxes. How can I make these items align in the center if the report grows horizontally, it looks kinda odd with report title not being in the center? Any input will be appreciated.
Hi ! I use ms sql server 2005, and I have a problem I have a dataBase where I have a lot of data, I have a webServices which calculate indicator for a time period and an id indicator. The time period must be specific and choose by the user, so I can't dto automatically by integrating the data from my webService in a dataBase (with IntegrationServices). So I create a report with 2 dataset, one which recover the indicator value for each equipment (the webService send a list of {<idEquipment> and <value>}) , and I want to link the idEquipment with the IdEquipement in my dataBase, it would allow me to know other informations about the equipment : equipement ID | Indicator value (from webServices) | equipment name | eq number | cumul of event duration for this eq.... All in the same grid... Does it possible ? If it is possible with the report designer, does it possible with report builder, as report builder need a model, how can i do to make a model from 2 dataSource... thank you for your answer...
We are trying to create an app where we pass dynamically a dataset (from our form in C#) to our {report}.rdl file.
We are having doubts about something.
How can we design the actual report if we don't have the datasource until runtime? The reason to do this is due to our complex calculations of data which becomes almost impossible to achieve in a T-SQL environment.
I know with a lot of patience and time (we don't have both) we can achieve it, but even though, we would need to process some data in the client side.
So, the question is... is it possible to design a report without a Dataset? I know we can drag the controls on the layout window, but we won't be able to test it. IS there any workaroung about this?
We are trying to convert our Crystal XI reports to SQL Reporting Services 2005. Our crystal reports get their data from ADO datasets which are populated through code at run time. Is it possible to do this in SQL Reporting Services?
The only options for a dataset seem to be query and stored procedure. When i have a blank dataset it throws an error. When i try to link my dataset to code, it throws an error.