Showing posts with label create. Show all posts
Showing posts with label create. Show all posts

Thursday, March 29, 2012

datatype problem

Hi Everyone,

In C# file:

bool abc; (it is working)

But in sql file: (bool is not working. What datatype should use for bool in the sql file?)

CREATE TABLEsb_payment_history (

sb_dispensing bool NULL <================ not working because bool is not known.

)

GO

Thanks,

May

You should use the bit datatype in your SQL table.

Tuesday, March 27, 2012

Datasource-Microsoft Visual Studio

Hi

I am new to all SQL Related. I am trying to create a datasource to our old database we used in the company to write reports on the data. when I create a new data source and enter all required info, when testing the connection, i get a reply that I do not have the necessary permissions to use this object, although my account is specified as an administrator? can somebody please explain this to me.

I am moving this to the SQL Server Security forum.|||

From where you are connecting (trying) to this new database?

Is it from Reporting services or any other application?

|||it is saved on my computer.|||You might check the permission for the user when trying to create this D-source connection, if the user do not have corresponding database privileges then it will fail.

Datasource-Microsoft Visual Studio

Hi

I am new to all SQL Related. I am trying to create a datasource to our old database we used in the company to write reports on the data. when I create a new data source and enter all required info, when testing the connection, i get a reply that I do not have the necessary permissions to use this object, although my account is specified as an administrator? can somebody please explain this to me.

I am moving this to the SQL Server Security forum.|||

From where you are connecting (trying) to this new database?

Is it from Reporting services or any other application?

|||it is saved on my computer.|||You might check the permission for the user when trying to create this D-source connection, if the user do not have corresponding database privileges then it will fail.

Datasource-Microsoft Visual Studio

Hi

I am new to all SQL Related. I am trying to create a datasource to our old database we used in the company to write reports on the data. when I create a new data source and enter all required info, when testing the connection, i get a reply that I do not have the necessary permissions to use this object, although my account is specified as an administrator? can somebody please explain this to me.

Hi Hanel O,

Try posting this query to the MSDN SQL Server Data Access Forum:
http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=87&SiteID=1&bcsi_scan_A9C07E6225287F19=z5cf+RkCipiHryeey+QUUQYAAAAmrYMB&bcsi_scan_filename=ShowForum.aspx

Also here is the MSDN SQL Server Forum main page, where you will find many SQL forums dedicated to different aspects of Microsoft SQL Server:
http://forums.microsoft.com/MSDN/default.aspx?ForumGroupID=19&SiteID=1

Also try looking in SQL Server Books Online, which comes as part of the SQL Server install package.

Hope this helps,

Frank

Datasource to AnalysisServices

I have a question regarding creating a datasource that connects to an
Analysis Services Database. (AS and RS are both 2005 editions.)
If I create a (shared) datasource to an Analysis server, and Specify the IP
address (10.200.23.24) of that server, I have no problems.
However, if I want to connect via HTTP, I am having a few problems.
-In the connection properties, I specify the Server Name to the HTTP url
(http://10.200.23.24/OLAP/msmdpump.dll)
-I specify a username and password with permissions to see the cubes and
data.
-I am able to select the database name from the dropdown list. (So,
obviously it is hitting the AS server, and the AS server is sending back the
databases in which I have permission to see.)
-If I select test connection, it initially fails, but if I go to the
advanced options, and remove the SSPI, test connection succeeds.
-Press OK to save the datasource, and run (preview) the report.
When I go to run (preview) the report, I get the following error:
"Non-Windows user credentials were supplied for a non-http connection to
Analysis Services. The Microsoft SQL Server Analysis Services data extension
requires Windows Integrated Security unless connecting via http or https"
I don't understand why I am getting that error when I am connecting via
http. Is there another property somewhere I have to turn on, so that it
knows I am using http?
As a side note, I know the HTTP connection works, as I can connect via HTTP
with both proclarity, and management studio. The problem only seems to be in
reporting services.
Any ideas?
-RyanHello Ryan,
What credetial mode you chose in the shared data source?
And have you follow this article to configure the HTTP access to AS 2005?
Configuring HTTP Access to SQL Server 2005 Analysis Services on Microsoft
Windows Server 2003
http://www.microsoft.com/technet/prodtechnol/sql/2005/httpasws.mspx
Sincerely,
Wei Lu
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================This posting is provided "AS IS" with no warranties, and confers no rights.|||The credentials are set at "Use a specific username and password".
I have the username of a local machine account on the server, and it's
password.
I've also tried the username in the format of MACHINENAME\UserName. That
didn't work either.
I know the http is set up properly, as I can access the cubes on that server
via HTTP with proclarity, and management studio, so I do not believe that is
the issue.
Does it have anything to do with the fact the report was designed with the
datasource pointing to a direct tcp connection, and then wanting to change
it to HTTP after the fact?
-Ryan
"Wei Lu [MSFT]" <weilu@.online.microsoft.com> wrote in message
news:rvJmMbUNHHA.2300@.TK2MSFTNGHUB02.phx.gbl...
> Hello Ryan,
> What credetial mode you chose in the shared data source?
> And have you follow this article to configure the HTTP access to AS 2005?
> Configuring HTTP Access to SQL Server 2005 Analysis Services on Microsoft
> Windows Server 2003
> http://www.microsoft.com/technet/prodtechnol/sql/2005/httpasws.mspx
> Sincerely,
> Wei Lu
> Microsoft Online Community Support
> ==================================================> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ==================================================> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>|||Here's a little bit more information:
The "Type" of the datasource is set as "Microsoft SQL Server Analysis
Services" . This is where I am having the issue where it works fine with tcp
connection, but HTTP connection gives the error.
If I change the type to OLEDB, and build a connection string to connect to
my cubes, when I preview the report, I get no errors.
However, nothing shows up for any of the queries. Warnings that say:
"The data set 'DatasetName' contains a definition for the Field 'FieldName'.
The field is missing from the returned resultset from the datasource."
Followed by:
"The data set 'DatasetName' contains a definition for the Field 'FieldName'.
The data extension returned an error during the reading of the field. THere
is no data for the field at position 5."
Further, I watched the profiler in analysis services, and it looks like the
right queries are being executed.
My questions are:
1. Do I have to use an OLEDB connection to use HTTP?
-If so, how do I get rid of the above errors? (Are they due to the fact
the datasets were designed with the analysis services connection type, then
switched to oledb?)
2. If I can use HTTP on the direct "Microsoft SQL Server Analysis Services"
connection type, is there anything else (advanced properties) that needs to
be set to make it work?
3. Has anyone successfully created a report using TCP on the direct
provider, then tried switching it to HTTP after the report was complete?
Thanks,
-Ryan|||Hello Ryan,
The reason why you could not connect to the Analysis Service Via http in
Reporting Services is because of the credential.
If you have enabled the Integrated Authentication in IIS, you need to use
the domain account. Or you need to specify a same account in the server as
the one you use in the local machine.
Please try this and let me know if this could not resolve your issue.
Sincerely,
Wei Lu
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================This posting is provided "AS IS" with no warranties, and confers no rights.|||Hi ,
How is everything going? Please feel free to let me know if you need any
assistance.
Sincerely,
Wei Lu
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================This posting is provided "AS IS" with no warranties, and confers no rights.

dataSource is different instance of same database(Urgent)

Hi,

I need help......

I am trying to create a report whose datasource will be different instances of the same database.So both the databases contains the same tables with same schema but the thing is that teh data is different.I have to collect the daat from different instances of the same table a(as they contains different different data) and using the collection to generate the report.

It's very very urgent ...plz reply ...

Thanx in advance

HI,

I dont thnk this is possible to do(as far as i know you cant connect a datasource to different database at runtime and also you cant change datasource at runtime). Now to solve your problem i can think of these solutions -

1. Create two datasources(connecting to two different database), and in your report create two datasets connecting to each one of the datasources. Similarly create two instances of tables (or whatever control you want to display) and connect controls to dataets. Now on runtime show/hide the table based on data from which table you want to show.

This is not a verygood choice(actually very poor) and you can achieve this using two copies of same report connecting to different databases and by showing the appropriate report to user.

2. Better approch is to have two tables in the same database like a_1 and a_2 and pass a parametre to your sp specifying which table to be used. In SP you will have to create dynamic sql in which table name will be created based on the parametre passed.

Hope i am able to convey whats there in my mind....

|||

Just came across this blog, it looks like we can dynamically change the connection string(did'nt tried though) -

http://blogs.msdn.com/bimusings/archive/2006/07/20/673051.aspx

DataSource for Exchange

I found some reports for exchanges.
Now I need to create a Datasource.
Does anyone know how to find the
exchange server name?
exchange login name?
exchange login password?
once I have a working datasource These reports should work.
Scott BurkeOn Nov 28, 3:20 pm, Scott Burke <ScottBu...@.discussions.microsoft.com>
wrote:
> I found some reports for exchanges.
> Now I need to create a Datasource.
> Does anyone know how to find the
> exchange server name?
> exchange login name?
> exchange login password?
> once I have a working datasource These reports should work.
> Scott Burke
This link might be helpful.
http://msdn2.microsoft.com/en-us/library/bb264455.aspx
Regards,
Enrique Martinez
Sr. Software Consultant|||Hi EMartinez, Thank you for the input. I did install the ManagementPack.exe
and it did stay it was installed but I cant find it on my computer! When I
try to reinstall the ManagementPack.exe but it state that it is installed.
IS this a stand alone programm? or is this a service? Do I have to find a
program to us this?
Scott Burke
"EMartinez" wrote:
> On Nov 28, 3:20 pm, Scott Burke <ScottBu...@.discussions.microsoft.com>
> wrote:
> > I found some reports for exchanges.
> > Now I need to create a Datasource.
> >
> > Does anyone know how to find the
> > exchange server name?
> > exchange login name?
> > exchange login password?
> >
> > once I have a working datasource These reports should work.
> >
> > Scott Burke
>
> This link might be helpful.
> http://msdn2.microsoft.com/en-us/library/bb264455.aspx
> Regards,
> Enrique Martinez
> Sr. Software Consultant
>

Sunday, March 25, 2012

Datasets that rely on parameters

Hi,
I'm trying to create a report under the following conditions:
1. I have a central database that has stored procedures that require @.db as
the parameter so you can specify where the data is coming from.
2. The report I have only wants data from a particular record, so I created
a second dataset to use in a dropdown list.
3.That second dataset uses a stored proc that requires a parameters @.id and
@.db
The problem is that the columns returned from the stored proc has the @.id
are not recognized when I try to specify them as the "value field" and the
"label field" in the Report Parameters Dialog box.
I suspect this is because it needs to know what the @.db is.
1. How do I get the second stored proc to be recognized by the Report
Parameters Dialog box?
2. How do I pass the @.db to the second stored proc without user intervention?
thanks,
-TrishIf I understand you correctly, what you are trying to do is called cascading
parameters. Search books on line for that and see if it answers you
question.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Trishmi" <Trishmi@.discussions.microsoft.com> wrote in message
news:FCF8157D-2E15-4FF7-B70D-DFB3955C9FE8@.microsoft.com...
> Hi,
> I'm trying to create a report under the following conditions:
> 1. I have a central database that has stored procedures that require @.db
> as
> the parameter so you can specify where the data is coming from.
> 2. The report I have only wants data from a particular record, so I
> created
> a second dataset to use in a dropdown list.
> 3.That second dataset uses a stored proc that requires a parameters @.id
> and
> @.db
> The problem is that the columns returned from the stored proc has the @.id
> are not recognized when I try to specify them as the "value field" and the
> "label field" in the Report Parameters Dialog box.
> I suspect this is because it needs to know what the @.db is.
> 1. How do I get the second stored proc to be recognized by the Report
> Parameters Dialog box?
> 2. How do I pass the @.db to the second stored proc without user
> intervention?
> thanks,
> -Trish

Datasets in report header/footer - A Summary of the issue

I know there are already a few threads on this topic but I wanted to create another one - and directly ask - how could this limitation possibly exists - and even more important - why is it still a problem in 2005?

I want to summarize a few of the solutions that have been listed here and elseware online. We've tried them all and they all have some kind of problem:

1) Create hidden field(s) and then reference that field from the header: Doesn't work on any pages where the field isn't printed. Header value will be blank in this case.

2) Create hidden column(s) in the data table and reference that from the header: Works, but again, if the table is showing on every page, the value will be blank. i.e. - if you have two or more tables stacked, you would have to add the columns to every one. A very sloppy and not practical solution.

3) Do it with custom code: I've seen this approach recomended but have never actually seen someone provide a working example. From what I understand, custom code can't access the datasets (I'm using 2000 - maybe 2005 is different here?)

4) Use a queried parameter to hold the value- then reference that in the header: This seems to be the best contender so far. It seems to work sometimes, but on several machines here, the report designer goes into some kind of infinite loop and crashes once the queried parameter is added.

If anyone has any other approaches that I'm not aware of, or has another idea, please post it here. Microsoft - this is a huge problem for many people. Is there any chance of a fix for this any time soon?

Thank you.

~H

did you find a solution ?

|||I am very interested in a solution, too.

Although I have found a 5th option, which works quite well for my scenario - nevertheless I don't consider it being very elegant (at least with "allow null values" enabled).

5) Use "Available values: From query"

All

report parameters are hidden and passed via the URL. The parameter

value is an ID, but in the page header my customer would like to see

the corresponding description.

I have have defined the available values to come from a query and specified the value and label fields. Now I can access the parameter value in the page header like e.g.

Parameters!ProcessId.Label

There's one drawback: if you're using parameters having "allow null value" enabled this version gives you an error when openen the report having passed NULL for the parameter (I have to translate the message from german to english):

The process ID parameter value is missing.


This problem can be solved, but I consider it being a quirk. Just use the following SQL for your data set:

select ProcessId, Desc from Processes
union
select ProcessId=NULL, Desc=NULL from Processes


I'm also interested in sharing other (more elegant) approaches.

Thanx for listening and kind regards,
Gerald


|||I am very interested in a solution, too.

Although I have found a 5th option, which works quite well for my scenario - nevertheless I don't consider it being very elegant (at least with "allow null values" enabled).

5) Use "Available values: From query"

All

report parameters are hidden and passed via the URL. The parameter

value is an ID, but in the page header my customer would like to see

the corresponding description.

I have have defined the available values to come from a query and specified the value and label fields. Now I can access the parameter value in the page header like e.g.

Parameters!ProcessId.Label

There's one drawback: if you're using parameters having "allow null value" enabled this version gives you an error when openen the report having passed NULL for the parameter (I have to translate the message from german to english):

The process ID parameter value is missing.


This problem can be solved, but I consider it being a quirk. Just use the following SQL for your data set:

select ProcessId, Desc from Processes
union
select ProcessId=NULL, Desc=NULL from Processes


I'm also interested in sharing other (more elegant) approaches.

Thanx for listening and kind regards,
Gerald


sql

Datasets in report header/footer - A Summary of the issue

I know there are already a few threads on this topic but I wanted to create another one - and directly ask - how could this limitation possibly exists - and even more important - why is it still a problem in 2005?

I want to summarize a few of the solutions that have been listed here and elseware online. We've tried them all and they all have some kind of problem:

1) Create hidden field(s) and then reference that field from the header: Doesn't work on any pages where the field isn't printed. Header value will be blank in this case.

2) Create hidden column(s) in the data table and reference that from the header: Works, but again, if the table is showing on every page, the value will be blank. i.e. - if you have two or more tables stacked, you would have to add the columns to every one. A very sloppy and not practical solution.

3) Do it with custom code: I've seen this approach recomended but have never actually seen someone provide a working example. From what I understand, custom code can't access the datasets (I'm using 2000 - maybe 2005 is different here?)

4) Use a queried parameter to hold the value- then reference that in the header: This seems to be the best contender so far. It seems to work sometimes, but on several machines here, the report designer goes into some kind of infinite loop and crashes once the queried parameter is added.

If anyone has any other approaches that I'm not aware of, or has another idea, please post it here. Microsoft - this is a huge problem for many people. Is there any chance of a fix for this any time soon?

Thank you.

~H

did you find a solution ?

|||I am very interested in a solution, too.

Although I have found a 5th option, which works quite well for my scenario - nevertheless I don't consider it being very elegant (at least with "allow null values" enabled).

5) Use "Available values: From query"

All

report parameters are hidden and passed via the URL. The parameter

value is an ID, but in the page header my customer would like to see

the corresponding description.

I have have defined the available values to come from a query and specified the value and label fields. Now I can access the parameter value in the page header like e.g.

Parameters!ProcessId.Label

There's one drawback: if you're using parameters having "allow null value" enabled this version gives you an error when openen the report having passed NULL for the parameter (I have to translate the message from german to english):

The process ID parameter value is missing.


This problem can be solved, but I consider it being a quirk. Just use the following SQL for your data set:

select ProcessId, Desc from Processes
union
select ProcessId=NULL, Desc=NULL from Processes


I'm also interested in sharing other (more elegant) approaches.

Thanx for listening and kind regards,
Gerald


|||I am very interested in a solution, too.

Although I have found a 5th option, which works quite well for my scenario - nevertheless I don't consider it being very elegant (at least with "allow null values" enabled).

5) Use "Available values: From query"

All

report parameters are hidden and passed via the URL. The parameter

value is an ID, but in the page header my customer would like to see

the corresponding description.

I have have defined the available values to come from a query and specified the value and label fields. Now I can access the parameter value in the page header like e.g.

Parameters!ProcessId.Label

There's one drawback: if you're using parameters having "allow null value" enabled this version gives you an error when openen the report having passed NULL for the parameter (I have to translate the message from german to english):

The process ID parameter value is missing.


This problem can be solved, but I consider it being a quirk. Just use the following SQL for your data set:

select ProcessId, Desc from Processes
union
select ProcessId=NULL, Desc=NULL from Processes


I'm also interested in sharing other (more elegant) approaches.

Thanx for listening and kind regards,
Gerald


Datasets and SQL Injection

I have become a big fan of the datasets in Visual Studio 2005. I usually create the SQL for each method in the table adapter; however, I am wondering if there is any 'built-in' functions in the C files for sql injection prevention? I have read that using stored procedures is a good method for prevention. Should I be using SP rather than SQL within my methods in the data table?

Hey,

Welcome to the forum. The key is, do you have any dataset queries that take user input and passes it to a SQL query directly? Then you may want to beware if that is true. I like the use of SPs because SQL Server will cache them for increased performance.

In addition, you should be able to use @.Parameters within a SQL query, and pass in the values as parameters, which is safer than embedding the response directly into the SQL query.

|||

wendycarpenter@.polk-county.net:

I am wondering if there is any 'built-in' functions in the C files for sql injection prevention?

Use parameterized queries!

http://aspnet.4guysfromrolla.com/articles/030106-1.aspx

|||

I am using parameterized queries - I've included a sample below. SQL Injection prevention has been "in the air" a lot lately and I guess I want to make sure that I am doing what I need to do to keep my customers' data safe.

INSERT INTO [Case] ([cseYear], [cseNumber], [cseStatus], [csePartI], [csePartII], [cseDestruction])

VALUES (@.cseYear, @.cseNumber, @.cseStatus, @.csePartI, @.csePartII, @.cseDestruction);
select SCOPE_IDENTITY()

|||

I appreciate the link. Maybe I wasn't specific enough. I am using the built in dataset (.xsd), so I am not creating any sql statement within my code - I strictly call the method within the datatable of the table adapter within the dataset. Most of the work is done within the auto generated code within Visual Studio 2005.

|||

Hey,

OK, which used the parameter approach I believe. That should be OK; I've seen several projects where Adapters were used even with secure info. Note that table adapters can also use stored procedures in case you want to be sure.

sql

Thursday, March 22, 2012

Dataset Query using Parameters

OK. I've got a tough one here. I am attempting to create a parameter .aspx
page that will pass in start date, end date and multiple storeIDs to the
report. A section of my query in the report dataset looks like this:
WHERE (dbo.SalesCheckDetails.SalesDate BETWEEN @.paramStartDate AND
@.paramEndDate) AND (dbo.SalesCheckDetails.StoreID IN (@.paramStore))
The problem is at the end with the @.paramStore. It works if you pass it
just one StoreID. The syntax becomes ...StoreID IN ('1')
When you try to pass it more than one storeid, it blows up. The syntax
becomes ...StoreID IN ('1,2') and an error comes up saying that it cannot
convert '1,2' to datatype int. Is there a way to take these leading and
trailing apostrophes off or can you think of a workaround? Thanks.You have to do a dynamically generated SQL statement, like this:
= "SELECT ... WHERE (dbo.SalesCheckDetails.SalesDate BETWEEN
@.paramStartDate AND > @.paramEndDate) AND (dbo.SalesCheckDetails.StoreID IN
(" & @.paramStore & "))"
It builds the SQL statement on the fly, so you won't be able to use the
query designer after this. I may not have put the quotes in properly, but I
hope you get the idea.
Cheers,
'(' Jeff A. Stucker
\
Business Intelligence
www.criadvantage.com
---
"BrianW" <BrianW@.discussions.microsoft.com> wrote in message
news:9FF1DC3A-463D-41BB-9130-631A5D0600FF@.microsoft.com...
> OK. I've got a tough one here. I am attempting to create a parameter
> .aspx
> page that will pass in start date, end date and multiple storeIDs to the
> report. A section of my query in the report dataset looks like this:
> WHERE (dbo.SalesCheckDetails.SalesDate BETWEEN @.paramStartDate AND
> @.paramEndDate) AND (dbo.SalesCheckDetails.StoreID IN (@.paramStore))
> The problem is at the end with the @.paramStore. It works if you pass it
> just one StoreID. The syntax becomes ...StoreID IN ('1')
> When you try to pass it more than one storeid, it blows up. The syntax
> becomes ...StoreID IN ('1,2') and an error comes up saying that it cannot
> convert '1,2' to datatype int. Is there a way to take these leading and
> trailing apostrophes off or can you think of a workaround? Thanks.|||Thanks Jeff but I can't seem to get this to work. It changes my quotation
marks to brackets and comes up with error "Identifier expected."
"Jeff A. Stucker" wrote:
> You have to do a dynamically generated SQL statement, like this:
> = "SELECT ... WHERE (dbo.SalesCheckDetails.SalesDate BETWEEN
> @.paramStartDate AND > @.paramEndDate) AND (dbo.SalesCheckDetails.StoreID IN
> (" & @.paramStore & "))"
> It builds the SQL statement on the fly, so you won't be able to use the
> query designer after this. I may not have put the quotes in properly, but I
> hope you get the idea.
> Cheers,
> '(' Jeff A. Stucker
> \
> Business Intelligence
> www.criadvantage.com
> ---
> "BrianW" <BrianW@.discussions.microsoft.com> wrote in message
> news:9FF1DC3A-463D-41BB-9130-631A5D0600FF@.microsoft.com...
> > OK. I've got a tough one here. I am attempting to create a parameter
> > .aspx
> > page that will pass in start date, end date and multiple storeIDs to the
> > report. A section of my query in the report dataset looks like this:
> >
> > WHERE (dbo.SalesCheckDetails.SalesDate BETWEEN @.paramStartDate AND
> > @.paramEndDate) AND (dbo.SalesCheckDetails.StoreID IN (@.paramStore))
> >
> > The problem is at the end with the @.paramStore. It works if you pass it
> > just one StoreID. The syntax becomes ...StoreID IN ('1')
> >
> > When you try to pass it more than one storeid, it blows up. The syntax
> > becomes ...StoreID IN ('1,2') and an error comes up saying that it cannot
> > convert '1,2' to datatype int. Is there a way to take these leading and
> > trailing apostrophes off or can you think of a workaround? Thanks.
>
>|||My advice in this situation is to back up and make sure you can create the
appropriate string.
Create a report that has the report parameters and a textbox and nothing
else. In the textbox put in the expression. Now you should be able to copy
and paste the result into query analyzer and it should work. Sometimes just
seeing the result will let you know what you are doing wrong.
--
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"BrianW" <BrianW@.discussions.microsoft.com> wrote in message
news:7236F404-0AB1-44C6-97A1-A601A1E2B738@.microsoft.com...
> Thanks Jeff but I can't seem to get this to work. It changes my quotation
> marks to brackets and comes up with error "Identifier expected."
> "Jeff A. Stucker" wrote:
> > You have to do a dynamically generated SQL statement, like this:
> >
> > = "SELECT ... WHERE (dbo.SalesCheckDetails.SalesDate BETWEEN
> > @.paramStartDate AND > @.paramEndDate) AND (dbo.SalesCheckDetails.StoreID
IN
> > (" & @.paramStore & "))"
> >
> > It builds the SQL statement on the fly, so you won't be able to use the
> > query designer after this. I may not have put the quotes in properly,
but I
> > hope you get the idea.
> >
> > Cheers,
> >
> > '(' Jeff A. Stucker
> > \
> >
> > Business Intelligence
> > www.criadvantage.com
> > ---
> > "BrianW" <BrianW@.discussions.microsoft.com> wrote in message
> > news:9FF1DC3A-463D-41BB-9130-631A5D0600FF@.microsoft.com...
> > > OK. I've got a tough one here. I am attempting to create a parameter
> > > .aspx
> > > page that will pass in start date, end date and multiple storeIDs to
the
> > > report. A section of my query in the report dataset looks like this:
> > >
> > > WHERE (dbo.SalesCheckDetails.SalesDate BETWEEN @.paramStartDate AND
> > > @.paramEndDate) AND (dbo.SalesCheckDetails.StoreID IN (@.paramStore))
> > >
> > > The problem is at the end with the @.paramStore. It works if you pass
it
> > > just one StoreID. The syntax becomes ...StoreID IN ('1')
> > >
> > > When you try to pass it more than one storeid, it blows up. The
syntax
> > > becomes ...StoreID IN ('1,2') and an error comes up saying that it
cannot
> > > convert '1,2' to datatype int. Is there a way to take these leading
and
> > > trailing apostrophes off or can you think of a workaround? Thanks.
> >
> >
> >

dataset query based on a global parameter

I need to create a report that displays data based on the userid. all the
records have a userid field filled with many userid values. how can I use the
global paramerer userid in the criteria for my dataset. so when a user run
the report olny records with his or her userid are showncreate a parameter with default value the global parameter. then use that
parameter in the query. ofcourse you can't use caching for those reports
"DJJIII" wrote:
> I need to create a report that displays data based on the userid. all the
> records have a userid field filled with many userid values. how can I use the
> global paramerer userid in the criteria for my dataset. so when a user run
> the report olny records with his or her userid are shown|||You do not have to have a 1:1 mapping between query parameters and report
parameters. Doing it the way suggested here means you have to muck around
with hiding it (since you don't want people to change it).
Have your query parameter, let's call it @.UserID. RS will automatically
recreate a report parameter called UserID but we won't use it. Click on the
..., go to parameters. Map the query parameter @.UserID to the global . The
parameter dialog box has a name and value columns. On the value side switch
it to expression. This brings you to the expression builder where you can
pick the User!UserID global variable. One thing to note, this variable has
the domain as well as the user id, so if you don't want this you will have
to strip it off.
Now, go you your layout, Report->Parameters and delete the now unneeded
UserID report parameter.
--
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Antoon" <Antoon@.discussions.microsoft.com> wrote in message
news:04C477F1-17E5-47C5-BB11-9EF31278F1CE@.microsoft.com...
> create a parameter with default value the global parameter. then use that
> parameter in the query. ofcourse you can't use caching for those reports
> "DJJIII" wrote:
>> I need to create a report that displays data based on the userid. all
>> the
>> records have a userid field filled with many userid values. how can I use
>> the
>> global paramerer userid in the criteria for my dataset. so when a user
>> run
>> the report olny records with his or her userid are shown|||great tip, that is indeed a lot more practical
"Bruce L-C [MVP]" wrote:
> You do not have to have a 1:1 mapping between query parameters and report
> parameters. Doing it the way suggested here means you have to muck around
> with hiding it (since you don't want people to change it).
> Have your query parameter, let's call it @.UserID. RS will automatically
> recreate a report parameter called UserID but we won't use it. Click on the
> ..., go to parameters. Map the query parameter @.UserID to the global . The
> parameter dialog box has a name and value columns. On the value side switch
> it to expression. This brings you to the expression builder where you can
> pick the User!UserID global variable. One thing to note, this variable has
> the domain as well as the user id, so if you don't want this you will have
> to strip it off.
> Now, go you your layout, Report->Parameters and delete the now unneeded
> UserID report parameter.
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
> "Antoon" <Antoon@.discussions.microsoft.com> wrote in message
> news:04C477F1-17E5-47C5-BB11-9EF31278F1CE@.microsoft.com...
> > create a parameter with default value the global parameter. then use that
> > parameter in the query. ofcourse you can't use caching for those reports
> >
> > "DJJIII" wrote:
> >
> >> I need to create a report that displays data based on the userid. all
> >> the
> >> records have a userid field filled with many userid values. how can I use
> >> the
> >> global paramerer userid in the criteria for my dataset. so when a user
> >> run
> >> the report olny records with his or her userid are shown
>
>

dataset problem

hi,

i am using dataset for passing value to crystal report.
when the stored procedure contains 2 tables then how to create the dataset1.xsd for two table.
query with join works fine in QA.
i tried by giving two tables in dataset schema but how to give two tables with selected fields as per the query.
which table i should mention in fill method.

please tell me a procedure how to do this.

i tried an alternative method also.
by creating dataset at runtime using adapter.
but without filteration as per query all data appears in the report.

thanksafter setting dataset using adapter, aand setting it to crystal use record selection formula.|||iam using crystal report.net in vb.net
can you send a sample code for this.
your help will be appreciated.|||Hi u can code something like this.

Dim srcCr As Object
Dim rptDoc As New ReportDocument

srcCr = rptDoc
srcCr.SetDataSource(dsObj) --dsobj is ur dataset
rptDoc.Load("\reports\abc.rpt")

srcCr.RecordSelectionFormula = "{command.AccID}=124"

hope it helps you

Wednesday, March 21, 2012

Dataset filtering... how?

Hi all,

I want to create a summary page for one of my report, depending on a
parameter, I would like to filter the dataset before creating the summary
fields.

I cannot figure out how to perform this filtering, my approach has been to
insert a Table control and map it to my dataset, then try and do some
filtering via the properties. When i then put something like

=sum(Fields!Sales.Value)

into the header (such that it is shown only once, not repeated), I get the
sum for the full dataset, not the filtered one.

Please help, is there any easier way todo this?

Lastly, I can't filter at the SQL level as the dataset is being used to
populate a chart below the summary.

Advice welcome.

Please help
Taz

Put the filter directly on the table (by opening the table properties dialog and selecting the filter tab).

Small sample report is attached at the bottom.

-- Robert

============================================================

<?xml version="1.0" encoding="utf-8"?>
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
<DataSources>
<DataSource Name="AdventureWorks">
<DataSourceReference>AdventureWorks</DataSourceReference>
<rd:DataSourceID>c2dc0e71-020b-48e3-9005-53286c923eb2</rd:DataSourceID>
</DataSource>
</DataSources>
<BottomMargin>1in</BottomMargin>
<RightMargin>1in</RightMargin>
<rd:DrawGrid>true</rd:DrawGrid>
<InteractiveWidth>8.5in</InteractiveWidth>
<rd:SnapToGrid>true</rd:SnapToGrid>
<Body>
<ReportItems>
<Table Name="table1">
<Footer>
<TableRows>
<TableRow>
<TableCells>
<TableCell>
<ReportItems>
<Textbox Name="textbox7">
<rd:DefaultName>textbox7</rd:DefaultName>
<ZIndex>3</ZIndex>
<Style>
<TextAlign>Right</TextAlign>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value>Sum</Value>
</Textbox>
</ReportItems>
</TableCell>
<TableCell>
<ReportItems>
<Textbox Name="value_1">
<rd:DefaultName>value_1</rd:DefaultName>
<ZIndex>2</ZIndex>
<Style>
<TextAlign>Right</TextAlign>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value>=Sum(Fields!value.Value)</Value>
</Textbox>
</ReportItems>
</TableCell>
</TableCells>
<Height>0.25in</Height>
</TableRow>
</TableRows>
</Footer>
<Filters>
<Filter>
<Operator>NotEqual</Operator>
<FilterValues>
<FilterValue>=2</FilterValue>
</FilterValues>
<FilterExpression>=Fields!id.Value</FilterExpression>
</Filter>
</Filters>
<DataSetName>DataSet1</DataSetName>
<Top>0.125in</Top>
<Width>4.33333in</Width>
<Details>
<TableRows>
<TableRow>
<TableCells>
<TableCell>
<ReportItems>
<Textbox Name="id">
<rd:DefaultName>id</rd:DefaultName>
<ZIndex>1</ZIndex>
<Style>
<TextAlign>Right</TextAlign>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value>=Fields!id.Value</Value>
</Textbox>
</ReportItems>
</TableCell>
<TableCell>
<ReportItems>
<Textbox Name="value">
<rd:DefaultName>value</rd:DefaultName>
<Style>
<TextAlign>Right</TextAlign>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value>=Fields!value.Value</Value>
</Textbox>
</ReportItems>
</TableCell>
</TableCells>
<Height>0.25in</Height>
</TableRow>
</TableRows>
</Details>
<Header>
<TableRows>
<TableRow>
<TableCells>
<TableCell>
<ReportItems>
<Textbox Name="textbox1">
<rd:DefaultName>textbox1</rd:DefaultName>
<ZIndex>5</ZIndex>
<Style>
<TextAlign>Right</TextAlign>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value>id</Value>
</Textbox>
</ReportItems>
</TableCell>
<TableCell>
<ReportItems>
<Textbox Name="textbox2">
<rd:DefaultName>textbox2</rd:DefaultName>
<ZIndex>4</ZIndex>
<Style>
<TextAlign>Right</TextAlign>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value>value</Value>
</Textbox>
</ReportItems>
</TableCell>
</TableCells>
<Height>0.25in</Height>
</TableRow>
</TableRows>
</Header>
<TableColumns>
<TableColumn>
<Width>2.16667in</Width>
</TableColumn>
<TableColumn>
<Width>2.16667in</Width>
</TableColumn>
</TableColumns>
<Height>0.75in</Height>
</Table>
</ReportItems>
<Height>1in</Height>
</Body>
<rd:ReportID>427ef1de-ff4a-42ab-96eb-9b4fbdc898e0</rd:ReportID>
<LeftMargin>1in</LeftMargin>
<DataSets>
<DataSet Name="DataSet1">
<Query>
<rd:UseGenericDesigner>true</rd:UseGenericDesigner>
<CommandText>select 1 as id, 5 as value union
select 2, 6 union
select 3, 7</CommandText>
<DataSourceName>AdventureWorks</DataSourceName>
</Query>
<Fields>
<Field Name="id">
<rd:TypeName>System.Int32</rd:TypeName>
<DataField>id</DataField>
</Field>
<Field Name="value">
<rd:TypeName>System.Int32</rd:TypeName>
<DataField>value</DataField>
</Field>
</Fields>
</DataSet>
</DataSets>
<Width>4.5in</Width>
<InteractiveHeight>11in</InteractiveHeight>
<Language>en-US</Language>
<TopMargin>1in</TopMargin>
</Report>

Dataset filtering... how?

Hi all,
I want to create a summary page for one of my report, depending on a
parameter, I would like to filter the dataset before creating the summary
fields.
I cannot figure out how to perform this filtering, my approach has been to
insert a Table control and map it to my dataset, then try and do some
filtering via the properties. When i then put something like
=sum(Fields!Sales.Value)
into the header (such that it is shown only once, not repeated), I get the
sum for the full dataset, not the filtered one.
Please help, is there any easier way todo this?
Lastly, I can't filter at the SQL level as the dataset is being used to
populate a chart below the summary.
Advice welcome.
Please help
TazIn the table properties you need to go to the Filter tab. You will then be
able to select the dataset field you want from the drop-down list and then
set what value(s) you want to include in the table.
HTH, Magendo_man
"Tarun Mistry" wrote:
> Hi all,
> I want to create a summary page for one of my report, depending on a
> parameter, I would like to filter the dataset before creating the summary
> fields.
> I cannot figure out how to perform this filtering, my approach has been to
> insert a Table control and map it to my dataset, then try and do some
> filtering via the properties. When i then put something like
> =sum(Fields!Sales.Value)
> into the header (such that it is shown only once, not repeated), I get the
> sum for the full dataset, not the filtered one.
> Please help, is there any easier way todo this?
> Lastly, I can't filter at the SQL level as the dataset is being used to
> populate a chart below the summary.
> Advice welcome.
> Please help
> Taz
>
>|||Thanks for ther reply.
I found that actually filtering directly on the dataset was my best option
(within the Data tab). My charts are working correctly on the condensed
data.
Taz
"magendo_man" <magendoman@.discussions.microsoft.com> wrote in message
news:C9DCDE28-059B-472C-BC4B-EDEC09C4E1B7@.microsoft.com...
> In the table properties you need to go to the Filter tab. You will then be
> able to select the dataset field you want from the drop-down list and then
> set what value(s) you want to include in the table.
> HTH, Magendo_man
> "Tarun Mistry" wrote:
>> Hi all,
>> I want to create a summary page for one of my report, depending on a
>> parameter, I would like to filter the dataset before creating the summary
>> fields.
>> I cannot figure out how to perform this filtering, my approach has been
>> to
>> insert a Table control and map it to my dataset, then try and do some
>> filtering via the properties. When i then put something like
>> =sum(Fields!Sales.Value)
>> into the header (such that it is shown only once, not repeated), I get
>> the
>> sum for the full dataset, not the filtered one.
>> Please help, is there any easier way todo this?
>> Lastly, I can't filter at the SQL level as the dataset is being used to
>> populate a chart below the summary.
>> Advice welcome.
>> Please help
>> Taz
>>

Dataset CommandType: TableDirect (Error)

In Visual Studio Report Designer data tab, whenever I try to create a new
dataset with the CommandType "TableDirect" I get the following message:
"An error has occurred while setting the Command Type property of the data
extension command. CommandType.TableDirect is not supported by the .Net
SqlClient Data Provider."
when I click OK to the dataset. I wonder why Visual Studio.NET would contain
a CommandType that is not supported. Any ideas what is causing this?
MalikSee
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemDataCommandTypeClassTopic.asp
for details.
--
Ravi Mumulla (Microsoft)
SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Abdul Malik Said" <diplacusis@.hotmNOSPAMail.com> wrote in message
news:uiM%23UDybEHA.1000@.TK2MSFTNGP12.phx.gbl...
> In Visual Studio Report Designer data tab, whenever I try to create a new
> dataset with the CommandType "TableDirect" I get the following message:
> "An error has occurred while setting the Command Type property of the data
> extension command. CommandType.TableDirect is not supported by the .Net
> SqlClient Data Provider."
> when I click OK to the dataset. I wonder why Visual Studio.NET would
contain
> a CommandType that is not supported. Any ideas what is causing this?
> Malik
>sql

DataSet Bug?

Hi,
###Problem 1###
I've encountered serveral times on this problem Every time when I used store
procedure to create a datatset. In the store procedure, it cannot have more
then 2 select statement even though the first select state is only shown when
a flag is turned on. For example :
...
set @.debug=0
if @.debug=1
select * from ABC
Select X, Y, Z from WWW
...
The dataset will shows the 1st select statement instead of the 2nd. I've to
deleted the those unwanted lines before my dataset is correct. Is this a bug?
###Problem 2###
Currently, I'm facing another problem with DataSet ...:(
This time when i wrote a intensive coding in the store procedure with
consists of quite a number of insert Temp tables. When I run the store
procedure using the Query Analyzer, my dataset is correct. However when I
used Reporting Services, I'm unable to get the correct dataset. Why is this
so?
Any help is definitely appreciated... ThanksPls ignore the 2nd problem. I've found the root cause. my Applogies...;P
But the 1st problem, i've encountered several times.
"Samie" wrote:
> Hi,
> ###Problem 1###
> I've encountered serveral times on this problem Every time when I used store
> procedure to create a datatset. In the store procedure, it cannot have more
> then 2 select statement even though the first select state is only shown when
> a flag is turned on. For example :
> ...
> set @.debug=0
> if @.debug=1
> select * from ABC
> Select X, Y, Z from WWW
> ...
> The dataset will shows the 1st select statement instead of the 2nd. I've to
> deleted the those unwanted lines before my dataset is correct. Is this a bug?
>
> ###Problem 2###
> Currently, I'm facing another problem with DataSet ...:(
> This time when i wrote a intensive coding in the store procedure with
> consists of quite a number of insert Temp tables. When I run the store
> procedure using the Query Analyzer, my dataset is correct. However when I
> used Reporting Services, I'm unable to get the correct dataset. Why is this
> so?
> Any help is definitely appreciated... Thanks

DataSet Accessing more than one database

Is there a way we can create a dataset that extracts data from more than one
database?
Example:
SELECT d.field1, u.field1
FROM Databse1.dbo.tbl_Test d, Databse2.dbo.tbl_User u
WHERE d.ID= u.IDyou could create a VIEW in database1 that does a select * from
database2.dbo.tbl_user
that way from the report server point of view they both come from the
same database
NJ wrote:
> Is there a way we can create a dataset that extracts data from more than one
> database?
> Example:
> SELECT d.field1, u.field1
> FROM Databse1.dbo.tbl_Test d, Databse2.dbo.tbl_User u
> WHERE d.ID= u.ID

DataSet Access from a matrix

Data Set Access from a matrix

I am trying to create a schedule by room number report.I am using a matrix.The column group that I am using is room number.There is no row group.When you group by room it is only allowing me access to the first data item for that room.Even though there are other data items for that room I can not access them.I can not access all data items in that grouping expression.Is there a way to get unobstructed access to a dataset while working in a matrix and grouping?

If you are not getting back the correct data... I would use a table format and grouping... you can "trick" the look of the report to appear like a matrix..

Hope this helps..

sql