Friday, March 30, 2012
passing null report parameter via a url
I have a SP in sql with parameters that can get null values such as:
@.paramguf tinyint=null,
AS
select 1 as kodKibuz,name
from learningstuds
where
(@.paramguf is null or hasamaguf=@.paramguf)
I am sending the report parameters via vb.net
Dim URL As String
URL = "http://localhost/reportserver/reports/tutorials?%2fTutorials%2fKibuzKlita1"
URL += "&rs:Command=render&rc:Parameters=false&rc:Toolbar=false"
URL += "¶mdate=" + Date32.saveDate().ToShortDateString
URL += "¶mguf=" + ddlGuf.SelectedValue
'Pass the URL as a Web request
'Dim request As HttpWebRequest = WebRequest.Create(URL)
Response.Redirect(URL)
How can I send a null value to the report for paramguf?
Thanksquoting KB article http://support.microsoft.com/kb/842853
You can also pass a null value for a parameter to a report by adding
'param:isnull=true' to the URL. For example, if the SalesOrderNumber is a
Null-valued report parameter that must be passed to the report, add the
'SalesOrderNumber:isnull=true' string to the URL."
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"collie" <collie@.discussions.microsoft.com> wrote in message
news:72BB20CA-9B8F-48F6-A3C8-6CCA1049EBE6@.microsoft.com...
> Hi,
> I have a SP in sql with parameters that can get null values such as:
> @.paramguf tinyint=null,
> AS
> select 1 as kodKibuz,name
> from learningstuds
> where
> (@.paramguf is null or hasamaguf=@.paramguf)
> I am sending the report parameters via vb.net
> Dim URL As String
> URL => "http://localhost/reportserver/reports/tutorials?%2fTutorials%2fKibuzKlita1"
> URL += "&rs:Command=render&rc:Parameters=false&rc:Toolbar=false"
> URL += "¶mdate=" + Date32.saveDate().ToShortDateString
> URL += "¶mguf=" + ddlGuf.SelectedValue
> 'Pass the URL as a Web request
> 'Dim request As HttpWebRequest = WebRequest.Create(URL)
> Response.Redirect(URL)
>
> How can I send a null value to the report for paramguf?
> Thanks
>
Passing null parameters via Query-String
I have one parameter that can receive null values...
Following Books Online, the syntax for null values is :isnull, giving the following sample of URL:
http://exampleWebServerName/reportserver?/foldercontainingreports/orders&division=mailorder®ion=west&sales:isnull
In my report, I shadowed this syntax, it looks like the following:
http://localhost/ReportServer?/ctr_es_reports/entrada_saida&dh_ini=2004-06-01&dh_fim=2004-07-20&func_cd_matricula:isnull
If I pass a common value to func_cd_matricula, like 1 or 2, it works fine, but with this isnull syntax, it gives me the following error:
"The path of the item '/ctr_es_reports/entrada_saida,func_cd_matricula:isnull' is not valid. The full path must be less than 260 characters long, must start with slash; other restrictions apply. Check the documentation for complete set of restrictions."
Does anybody know why this?
Thanks,
Rafa®BOL is incorrect.
Right syntax is
sales:isNull=true
Lev
http://blogs.msdn.com/levs
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Rafa®" <Rafa®@.discussions.microsoft.com> wrote in message
news:4308595B-5A3C-4F4D-ADAD-D9288B71B926@.microsoft.com...
> I'm trying to call a report, passing my parameters via query-string...
> I have one parameter that can receive null values...
> Following Books Online, the syntax for null values is :isnull, giving the
> following sample of URL:
> http://exampleWebServerName/reportserver?/foldercontainingreports/orders&division=mailorder®ion=west&sales:isnull
> In my report, I shadowed this syntax, it looks like the following:
> http://localhost/ReportServer?/ctr_es_reports/entrada_saida&dh_ini=2004-06-01&dh_fim=2004-07-20&func_cd_matricula:isnull
> If I pass a common value to func_cd_matricula, like 1 or 2, it works fine,
> but with this isnull syntax, it gives me the following error:
> "The path of the item
> '/ctr_es_reports/entrada_saida,func_cd_matricula:isnull' is not valid. The
> full path must be less than 260 characters long, must start with slash;
> other restrictions apply. Check the documentation for complete set of
> restrictions."
> Does anybody know why this?
> Thanks,
> Rafa®sql
Wednesday, March 28, 2012
passing multivalue parameter in a URL action
How can I pass a multivalue parameter via a URL action on a report item?
I've tried using Split and Join but it doesnt work.
Any ideas?
Multivalue paramters are accessed in URL within the following schema:Report_Param_Name=A&Report_Param_Name=B&Report_Param_Name=C
so AFAIK you would have to write some own sophisticated code to do this.
HTH; Jens Suessmeyer.
http://www.sqlserver2005.de|||
What if we have to pass select all as a parameter?
I am trying to pass select all as parameter because I have a lot of items and IE won't let me pass such a big url.
Please help.
|||There is no special "select all" value.
If you have many values, maybe you should redesign your query/report so that you add a special value to the valid value list which has the implicit semantics of "select all" in your dataset.
-- Robert
Monday, March 26, 2012
Passing in a default parameter date via a URL
Hi Guys,
What is the syntax for passing in a default parameter of current date via a URL.
cheers
If you don't want to have to deal with IFormatProvider and DateTimeStyles of DateTime.Parse() method, then you can simply use the "MM/dd/yyyy" format. For example:string dateToConvert = "12/25/2006";
DateTime today = DateTime.Parse(dateToConvert);
So, in your url, simply do: myPage.aspx?date=12/25/2006
Then retrieve the query string (Request.QueryString["date"]), check to make sure it's not null and not empty, and then finally convert it using the above mentioned DateTime.Parse(...).|||
Thanks jcasp.
This isn't quite what I meant. I want the currentdate to be passed in which I do not know of beforehand. Usually in VB I use Now or Date what is the equivalent.
Cheers
|||Hi,
you can use DateTime.Now in .NET.
Grz, Kris.
Passing Global Variables from a Execute Package Task
Edit your Execute Package Task, and click on the "Outer Package Global Variables" tab. Select all the Global Variables you want available to Package 2. Save and close.
Package 2:
Edit your ActiveX Script Task and use the code below to access the variable:
DTSGlobalVariables("<global variable name>").Value|||Package1 doesnt have an Execute Package Task, Package2 does...
Package1:
ActiveX Script --> Connection1 -TransformData-> Connection2
Package2:
Exec Package1 -Success-> Send Success Email
'-Failure-> ActiveX (msgbox DTSGlobalVariables("sErrorMessage").Value) --> Send Failure Email|||Ooookay.. so substitute 2 for 1 and 1 for 2... done...|||Thats what I figured when you posted, but I tried that and got nothing.....I might have edited the reply since you looked at it...
When I run Package1 by itself I can see in the Package1 Properties that the Global Variable is being set properly from Package1.
The Execute Package Task in Package2 has the Outer Package Global Variable selected, but when I reference it with DTSGlobalVariables("sErrorMessage").Value in ActiveX Code it shows the variable as being empty.|||Just a update on this:
Seppuku was nice enough the help me via AIM. So far we have come to the conclusion that there is no builtin way for a child to pass data to the parent except maybe through file drops, or writing to a db table.|||Will attempt having the child write to a common table for communication...and will post the results here.
Friday, March 23, 2012
Passing datetime variable to stored proc as parameter
Hello,
I'm attempting to pass a datetime variable to a stored proc (called via sql task). The variables are set in a previous task where they act as OUTPUT paramters from a stored proc. The variables are set correctly after that task executes. The data type for those parameters is set to DBTIMESTAMP.
When I try to exectue a similar task passing those variables as parameters, I get an error:
Error: 0xC002F210 at ax_settle, Execute SQL Task: Executing the query "exec ? = dbo.ax_settle_2 ?, ?,?,3,1" failed with the following error: "Invalid character value for cast specification". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
If I replace the 2nd and 3rd parameters with quoted strings, it is successful:
exec ?= dbo.ax_settle ?, '3/29/06', '4/30/06',3,1
The stored proc is expecting datetime parameters.
Thanks for the help.
Mike
As a stopgap, I'm building the exec statement in an expression - converting the dates to single quoted strings.
I would still like to see the correct way to pass date parameters, so if anybody can help it would be much appreciated.
Thankee.
Mike
|||Any chance your passing the value in as type "DBTimestamp"? Try changing the parameter to type DATE
This looks like a bug to me:
setup:
1. Extract date from query (SSIS will show type as DBTIMESTAMP..)
2. Pass that same date taken from SQL Server as a parameter of type DBTimestamp back into the same SQL Server (using same connection) and it will error with message like you have above.
I tried changing the stored procedure to take nvarchar(2000) so I could see what it was passing for the DBTimestamp parameter to SQL and it was passing '' (empty set.. not to be confused with NULL)
Passing DateAdd Parameters Via Sproc
I am kinda stumped with this one and would appreciate any suggestions.
I want to pass two parameters (@.period_unit and @.period_type) so that the
sproc
can calculate the exiry date which is inserted into the table. Below is some
psedo code
for the sproc in question. I envisaged calling the sproc as such ...
EXEC MYPROC 20, 100, 200, 'year', 1, 1
or
EXEC MYPROC 20, 100, 200, 'month', 6, 1
However, when I try and save the sproc I get the error
"invalid parameter 1 specified for dateadd". If I "hard code" the
@.date_expires_utc variable to year, it works fine meaning that the
dateadd function accepts the value @.period_unit as it's second
parameter but doesn't accept @.period_type as it's first parameter.
Go figure! Anyway, any and all suggestions most welcome and encouraged.
PS: I realize that I could pass the creation and expiry date from the
calling code
but I would prefer the sproc to calculate these dates.
Thanks Peter
---
CREATE TABLE MYTABLE (
coupon_id integer identity(1, 1) not null,
member_id integer not null,
transaction_id integer not null,
status char(1) not null,
date_created_utc smalldatetime not null,
date_expires_utc smalldatetime not null
)
CREATE PROCEDURE MYPROC
@.count integer,
@.member_id integer,
@.transaction_id integer,
@.period_unit integer,
@.period_type varchar(20),
@.status char(1)
AS
SET NOCOUNT ON
DECLARE @.date_created_utc smalldatetime
DECLARE @.date_expires_utc smalldatetime
DECLARE @.counter integer
SET @.date_created_utc = GetUtcDate()
SET @.date_expires_utc = DateAdd(@.period_unit, @.period_unit,
@.date_created_utc)
SET @.counter = 1
WHILE (@.counter <= @.count)
BEGIN
INSERT INTO MYTABLE (
[member_id],
[transaction_id],
[status],
[date_created_utc],
[date_expires_utc] )
VALUES (
@.member_id,
@.transaction_id,
@.status,
@.date_created_utc,
@.date_expires_utc )
SET @.counter = @.counter + 1
END
SELECT coupon_id
FROM MYTABLE
WHERE transaction_id = @.transaction_id
ORDER BY coupon_id
---
--== Posted via mcse.ms - Unlimited-Unrestricted-Secure Usenet News=
=--
http://www.mcse.ms The #1 Newsgroup Service in the World! 120,000+ New
sgroups
--= East and West-Coast Server Farms - Total Privacy via Encryption =--Hi, Peter
Instead of:
SET @.date_expires_utc = DateAdd(@.period_unit, @.period_unit,
@.date_created_utc)
You can use:
IF @.period_unit='year'
SET @.date_expires_utc = DateAdd(year, @.period_unit,
@.date_created_utc)
IF @.period_unit='month'
SET @.date_expires_utc = DateAdd(month, @.period_unit,
@.date_created_utc)
[...]
Razvan|||Razvan
Thanks for that. It is, in fact, exactly what I ended up doing although it
seems a little messy.
I still find it a little strange that the dateadd function accepts an sproc
parameter as it's own second
parameter but not as its first parameter.
Regards
Peter
"Razvan Socol" <rsocol@.gmail.com> wrote in message
news:1139386825.679863.20140@.f14g2000cwb.googlegroups.com...
> Hi, Peter
> Instead of:
> SET @.date_expires_utc = DateAdd(@.period_unit, @.period_unit,
> @.date_created_utc)
> You can use:
> IF @.period_unit='year'
> SET @.date_expires_utc = DateAdd(year, @.period_unit,
> @.date_created_utc)
> IF @.period_unit='month'
> SET @.date_expires_utc = DateAdd(month, @.period_unit,
> @.date_created_utc)
> [...]
> Razvan
>
--== Posted via mcse.ms - Unlimited-Unrestricted-Secure Usenet News=
=--
http://www.mcse.ms The #1 Newsgroup Service in the World! 120,000+ New
sgroups
--= East and West-Coast Server Farms - Total Privacy via Encryption =--
Wednesday, March 21, 2012
Passing Command line arguments from Visual Studio
Is it possible to pass command line arguments to a package when running it from within VS? I want to set the value of a variable via the commandline, and found that you can to this in DtExec with the "/set \Package.Variables[...].Value;..." syntax. According to the docs, you should be able to pass the same argument via the 'CmdLineArguments' property in the 'Properties' dialog of an SSIS project in VS (CmdLineArguments. Run the package with the specified command-line arguments. For information about command-line arguments, see dtexec Utility), but unfortunately, this doesn't seem to work (even though the exact same argument does work when entered in DtExec)
Any help would be greatly appreciated :-)
Steven
No. Since you are in a IDE/Debug environment with Visual Studio, I think it is a minor limitation that you cannot do this, you can just change and set anything your require in the IDE.
If you have external configuration information you wish to set all the time then /SET is probably not the best solution. Using the built in Configurations support in SSIS would be a better choice and this does work in VS. See the SSIS menu.
|||I have the exact same issue. I just need a single parameter that needs to change every time I call my package, so it doesn't really warrant external configuration. The following article implies that CmdLineArguments are only taken into account whenever you use dtexec externally to execute the package and then attach to it to debug. See the last section ("Testing and Debugging your code") for details.
http://msdn2.microsoft.com/en-us/library/ms403356.aspx
Passing Command line arguments from Visual Studio
Is it possible to pass command line arguments to a package when running it from within VS? I want to set the value of a variable via the commandline, and found that you can to this in DtExec with the "/set \Package.Variables[...].Value;..." syntax. According to the docs, you should be able to pass the same argument via the 'CmdLineArguments' property in the 'Properties' dialog of an SSIS project in VS (CmdLineArguments. Run the package with the specified command-line arguments. For information about command-line arguments, see dtexec Utility), but unfortunately, this doesn't seem to work (even though the exact same argument does work when entered in DtExec)
Any help would be greatly appreciated :-)
Steven
No. Since you are in a IDE/Debug environment with Visual Studio, I think it is a minor limitation that you cannot do this, you can just change and set anything your require in the IDE.
If you have external configuration information you wish to set all the time then /SET is probably not the best solution. Using the built in Configurations support in SSIS would be a better choice and this does work in VS. See the SSIS menu.
|||I have the exact same issue. I just need a single parameter that needs to change every time I call my package, so it doesn't really warrant external configuration. The following article implies that CmdLineArguments are only taken into account whenever you use dtexec externally to execute the package and then attach to it to debug. See the last section ("Testing and Debugging your code") for details.
http://msdn2.microsoft.com/en-us/library/ms403356.aspx
sqlPassing an indeterminate number of parameters
Does anyone know if it's possible to somehow pass an unknown number of
parameters to a storerd procedure.
For example via an array of some description? Alternatively, in C# you can
use the keyword "params" when the number of parameters to be passed is
unknown at design time. I don't think there is any equivalent in SQL server
though is there?
Thanks everyone
Simon
Array datatype is not supported in SQL Server. However you can use certain
workarounds for such requirements, some of which are detailed at:
http://www.sommarskog.se/arrays-in-sql.html
Anith
|||Simon
As far as I know there is not a way to do what you ask. What I feel you will have to do is program your proc for the most parameters possible and give them default values. That way if you only pass a few then your proc knows what to do with the remainin
g values. You can easily build the string you pass to the proc in your code.
Hope this helps
Jeff Duncan
MCDBA, MCSE+I
|||Thanks guys. Both very useful answers
Kindest regards
Simon
Passing an indeterminate number of parameters
Does anyone know if it's possible to somehow pass an unknown number of
parameters to a storerd procedure.
For example via an array of some description? Alternatively, in C# you can
use the keyword "params" when the number of parameters to be passed is
unknown at design time. I don't think there is any equivalent in SQL server
though is there?
Thanks everyone
SimonArray datatype is not supported in SQL Server. However you can use certain
workarounds for such requirements, some of which are detailed at:
http://www.sommarskog.se/arrays-in-sql.html
Anith|||Simon
As far as I know there is not a way to do what you ask. What I feel you wil
l have to do is program your proc for the most parameters possible and give
them default values. That way if you only pass a few then your proc knows w
hat to do with the remainin
g values. You can easily build the string you pass to the proc in your code
.
Hope this helps
Jeff Duncan
MCDBA, MCSE+I|||Thanks guys. Both very useful answers
Kindest regards
Simon
Passing an indeterminate number of parameters
Does anyone know if it's possible to somehow pass an unknown number of
parameters to a storerd procedure.
For example via an array of some description? Alternatively, in C# you can
use the keyword "params" when the number of parameters to be passed is
unknown at design time. I don't think there is any equivalent in SQL server
though is there?
Thanks everyone
SimonArray datatype is not supported in SQL Server. However you can use certain
workarounds for such requirements, some of which are detailed at:
http://www.sommarskog.se/arrays-in-sql.html
--
Anith|||Simo
As far as I know there is not a way to do what you ask. What I feel you will have to do is program your proc for the most parameters possible and give them default values. That way if you only pass a few then your proc knows what to do with the remaining values. You can easily build the string you pass to the proc in your code
Hope this help
Jeff Dunca
MCDBA, MCSE+I|||Thanks guys. Both very useful answers
Kindest regards
Simon
Monday, March 12, 2012
Passing a schema to a cube via AMO
Oh, i'm using SQL Server 2k5.
When i build the cube through Dev Studio, it will process dimensions as expected. So, when pulling data, i can look at the SQL and see (for example):
"Select blah from Schema.TableName"
Which is what i want. However, when i build the cube using AMO i can not process the dimension, and it's failing because the SQL reads:
"Select blah from TableName"
A quick fix for me is to remove the Schema from my tables.. so, dbo.TableName works fine. But that's not exactly what i want. Or, i can create stored procs that pull the data from any table/schema, but that's not what i want either..
So, i guess i'm asking if there's a way to pass a schema to a dataset and have it read by the cube.
Any help would be appreciated..
Thanks,
Chris.
The following snippet is from the AMOAdventureWorks sample that is part of the SQL Server 2005 samples. It comes from the part of the program where they are building the DSV. Note that there are two points where the dbo schema is hard coded. I am hoping that by passing in your own schema name will resolve your issue.
|||excellent, thanks so much!staticvoid AddTable(DataSourceView dsv, OleDbConnection connection, String tableName)
{
OleDbDataAdapter adapter = newOleDbDataAdapter(
"SELECT * FROM [dbo].[" + tableName + "] WHERE 1=0",
connection);
DataTable[] dataTables = adapter.FillSchema(dsv.Schema,
SchemaType.Mapped, tableName);
DataTable dataTable = dataTables[0];
dataTable.ExtendedProperties.Add("TableType", "Table");
dataTable.ExtendedProperties.Add("DbSchemaName", "dbo");
dataTable.ExtendedProperties.Add("DbTableName", tableName);
dataTable.ExtendedProperties.Add("FriendlyName", tableName);
}
dataTable.ExtendedProperties.Add("DbSchemaName", "dbo"); worked exactly as i needed it to, by replacing it with my own schema name.
Passing a parameter to a URL in a browser SQL SERVER REPORTING SERVICES 2000
I can't seem to get parameters to pass via an URL according to the
documentation..
http://certol/Reports/Pages/Report.aspx?ItemPath=%2fFSDBMR%2fManufacturing%2fPlanning+Data&Active_Obsolete_None_Filter=2
(btw Active_Obsolete_None_Filter is the parameter )
Is there something wrong with this syntax? It does bring up the report, but
it doesn't pass along the parameter... Any clues? I've tried several
different variations...
thanks in advance..Reports is the Report Manager portal. The actual server is reportserver. You
need to use reportserver, not reports. I.e.
http://yourserver/ReportServer?/YourFolder/YourReport&Param1=Param1Value
Note that parameters are case sensitive.
--
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"certolnut" <whitney_neal@.hotmail.com> wrote in message
news:u3zatoTFGHA.984@.tk2msftngp13.phx.gbl...
> Hi all..
> I can't seem to get parameters to pass via an URL according to the
> documentation..
> http://certol/Reports/Pages/Report.aspx?ItemPath=%2fFSDBMR%2fManufacturing%2fPlanning+Data&Active_Obsolete_None_Filter=2
> (btw Active_Obsolete_None_Filter is the parameter )
> Is there something wrong with this syntax? It does bring up the report,
> but it doesn't pass along the parameter... Any clues? I've tried several
> different variations...
> thanks in advance..
>|||Thanks, Worked like a charm...
"Bruce L-C [MVP]" <bruce_lcNOSPAM@.hotmail.com> wrote in message
news:ubPOWuTFGHA.3172@.TK2MSFTNGP10.phx.gbl...
> Reports is the Report Manager portal. The actual server is reportserver.
> You need to use reportserver, not reports. I.e.
> http://yourserver/ReportServer?/YourFolder/YourReport&Param1=Param1Value
> Note that parameters are case sensitive.
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
> "certolnut" <whitney_neal@.hotmail.com> wrote in message
> news:u3zatoTFGHA.984@.tk2msftngp13.phx.gbl...
>> Hi all..
>> I can't seem to get parameters to pass via an URL according to the
>> documentation..
>> http://certol/Reports/Pages/Report.aspx?ItemPath=%2fFSDBMR%2fManufacturing%2fPlanning+Data&Active_Obsolete_None_Filter=2
>> (btw Active_Obsolete_None_Filter is the parameter )
>> Is there something wrong with this syntax? It does bring up the report,
>> but it doesn't pass along the parameter... Any clues? I've tried several
>> different variations...
>> thanks in advance..
>
Friday, March 9, 2012
Passing "hidden parameter" to Report via URL
Hi,
We are trying to pass a parameter ("hidden from user") to our report which we
access via an URL. Has anyone done this successfully? If so please outline the steps
and we'll be greatful forever!
Note: We have the latest Reporting Services software SP2 installed.
We have MS SQL Server Standard Edition - and thus do not have Report Manager on our server.
HTH|||Thanks for your reply - however we are not concerned with the URL line itself. The problem is that the
value never gets to the report and we get an error message about the parameter being 'read-only'.
If anyone has successfully passed an URL parameter to a report please document and share the steps! Many Thanks!
We have latest version of Reporting Services SP2, and MS SQL Server 2000 standard version.|||OK. Found the answer:
1) Make sure Reporting Services SP2 is installed.
2) Set up the report as if the user will be selecting /entering the parameter value.
3) Make sure the Report runs correctly.
4) Go back into the Report Designer and change the prompt string to one blank.
5) Test in designer (the parameter name will be used as a default prompt).
6) Deploy
7) Run report - passing parameter in the URL. This works, and you will not see a prompt.|||
Hi, I am facing the same problem. Can any one please provide me 'real' solution(code example) how to do it.
jrokita has tried to ans the Q but not enough support. The main Q was how to do it with URL. Not steps the way it will be done.
Thanks in advance.
Wednesday, March 7, 2012
Pass user credentials RS web service?
app, which is running under a service account.
I need to pass in the user's credentials to the Render method to make
sure the user has been given access to the report on the Security tab
of the front end.
If I pass the default credentials, the service account's credentials
are used.
Can anyone help? Many thanks.
BurtYou need to create an instance of System.Net.NetworkCredential.
Try:
rs.Credentials = new System.Net.NetworkCredential(UserName, Password);
instead of:
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
"Burt" wrote:
> I'm using the RS web service to pull back customized reports via a C#
> app, which is running under a service account.
> I need to pass in the user's credentials to the Render method to make
> sure the user has been given access to the report on the Security tab
> of the front end.
> If I pass the default credentials, the service account's credentials
> are used.
> Can anyone help? Many thanks.
> Burt
>|||David,
Thanks, but how do I get the current user's password? I'm using windows
authentication on this intranet app.
Burt|||FYI, the solution was:
WindowsImpersonationContext windowsImpersonationContext = null;
WindowsIdentity currentIdentity =(WindowsIdentity)Thread.CurrentPrincipal.Identity;
windowsImpersonationContext = currentIdentity.Impersonate();
MyService.Credentials =System.Net.CredentialCache.DefaultCredentials;
windowsImpersonationContext.Undo();
windowsImpersonationContext = null;
Pass RS SessionID via URL
I am trying to start a report services session by calling the Render
method in code. This works fine - a session ID is generarted in the
SessionHeaderValue. Now, I would like to able to that same session
via URL. Here's the VB code snippit:
--
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
rs.SessionHeaderValue = sh
result = rs.Render(sender_button.CommandArgument, format, history_id,
_
dev_info, parameter_values, credentials, show_hide_toggle, encoding,
_
mime_type, report_history_parameters, warnings, stream_ids)
Dim temp As String
temp = "http://localhost/ReportServer?%2fDemo+Project%2fMyReport&rs:Command=Render&rs:SessionID="
& rs.SessionHeaderValue.SessionID
Response.Redirect(temp)
--
The redirect works fine, but the Report Server pops up a login screen.
If I have already started the session, and pass the session ID, should
the login still be required?
Any insight on this would be appreciated.
Thanks,
TerryIs rs.Url the same as the root of your temp string? I.e. it's localhost, not
the machine name?
--
Tudor Trufinescu
Dev Lead
Sql Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Terry Romance" <tedgromance@.yahoo.com> wrote in message
news:f284ebe.0407230821.3a7bb882@.posting.google.com...
> Can anybody tell me if the following should work:
> I am trying to start a report services session by calling the Render
> method in code. This works fine - a session ID is generarted in the
> SessionHeaderValue. Now, I would like to able to that same session
> via URL. Here's the VB code snippit:
> --
> rs.Credentials = System.Net.CredentialCache.DefaultCredentials
> rs.SessionHeaderValue = sh
> result = rs.Render(sender_button.CommandArgument, format, history_id,
> _
> dev_info, parameter_values, credentials, show_hide_toggle, encoding,
> _
> mime_type, report_history_parameters, warnings, stream_ids)
> Dim temp As String
> temp ="http://localhost/ReportServer?%2fDemo+Project%2fMyReport&rs:Command=Render&
rs:SessionID="
> & rs.SessionHeaderValue.SessionID
> Response.Redirect(temp)
> --
> The redirect works fine, but the Report Server pops up a login screen.
> If I have already started the session, and pass the session ID, should
> the login still be required?
> Any insight on this would be appreciated.
> Thanks,
> Terry|||Thanks for the reply, Tudor.
The Url of the reporting service is:
"http://localhost/ReportServer/ReportService.asmx" which matches the
root of the 'temp' string in the code.
Is there anything else I should check?
Thank you,
Terry
"Tudor Trufinescu \(MSFT\)" <tudortr@.ms.com> wrote in message news:<OyNbI52cEHA.2236@.TK2MSFTNGP10.phx.gbl>...
> Is rs.Url the same as the root of your temp string? I.e. it's localhost, not
> the machine name?
> --
> Tudor Trufinescu
> Dev Lead
> Sql Server Reporting Services
> This posting is provided "AS IS" with no warranties, and confers no rights.
>|||Tudor,
Ignore my last reply. The URL's were the same on my development box, but
different on our live server. After I made sure they were the same on the live
server, it worked.
Thanks for your help!
Regards,
Terry|||Tudor:
I spoke too soon. It works only if I run it from the local machine. If
I try to access it from a remote machine via IE, it asks for authorization.
Thanks,
Terry|||If your app and RS are on different machines, you may be hitting the 2
machine hop limitation that exists in NTLM. NTLM credentials do not flow on
more than one machine.
client => your app => RS server
If you are on Windows 2003, you can use Kerberos, and enable delegation
between your app machine and the RS server machine. You could also use basic
auth over SSL (do not use it over plain HTTP as credentials are passed in
un-encrypted on the wire) or forms/custom authentication - but that requires
you write more code and has numerous other security implications.
--
Tudor Trufinescu
Dev Lead
Sql Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Terry Romance" <tedgromance@.yahoo.com> wrote in message
news:f284ebe.0407270626.253a9ee4@.posting.google.com...
> Tudor:
> I spoke too soon. It works only if I run it from the local machine.
If
> I try to access it from a remote machine via IE, it asks for
authorization.
> Thanks,
> Terry
Monday, February 20, 2012
Pass a collection to a SPROC
this works using a query string within my code
WHERE (dbo.Promotions.ExpirationDate > GETDATE()) AND (dbo.Promotions.CompanyID IN (" + selectedCompanies + "))
this doesn't within my sproc
WHERE (dbo.Promotions_ByLink.ExpirationDate > GETDATE()) AND (dbo.Promotions_ByLink.CompanyID IN (@.SelectedCompanies))
I also tried
WHERE (dbo.Promotions_ByLink.ExpirationDate > GETDATE()) AND (dbo.Promotions_ByLink.CompanyID IN (SELECT @.SelectedCompanies))
and
WHERE (dbo.Promotions_ByLink.ExpirationDate > GETDATE()) AND (dbo.Promotions_ByLink.CompanyID IN (' + @.SelectedCompanies + '))
ThanksI know it's a little dirty, but I just created an user defined function to parse out a comma delimited string, and return a recordset of one column. Select [code] FROM dbo.MyFunctionName(@.myCommaDelimitedString) can be used in your where clause.|||Thanks,
I will give that a try|||We've had this discussion several times in this forum -- there are various solutions and various advocates of the different solutions (e.g.view post 306752). I happen to use the one KraGiE suggests. Here's an example of the parsing function:Treat Yourself to Fn_Split().
Terri|||Thanks a TON..I search the other post, but I didn't know what to search for.
Thanks again
Partner works from mirror to principal, but not vice versa.
We were having problems setting up the mirroring, so I did it via command lines. I found out the "alter...set partnership" command works on the mirror server going to the principal, but gets a 1418 error when going from the principal to the mirror.
So if A is the principal and B is the mirror, A to B fails but B to A works.
If I reverse it so that B is the principal and A is the mirror, B to A fails and A to B works.
Any suggestions?
Here’s an update on our problem.
We are now doing it thru Management Studio. We set up the mirroring, but answer “no” when it asks to start mirroring and go back to the mirroring screen. One of the default names contains the domain but the other does not.
We replace the address field with the IP addresses for the Principal and Mirror Network Addresses (no witness). When we click on “start mirroring”, the Principal’s name gets changed back to the dns name, but the mirror name remains an IP address. This is true even when we switch which server is the principal and which the mirror.
It seems to me that because it always happens the same way for the mirror and principal addresses, regardless of the server, that this might be a bug.
|||Fixed it!
We did two things:
- Went to C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\MachineKeys and set the administrators permission to Full Control and
- Edited the C:\WINDOWS\system32\drivers\etc\hosts file on each server to include
IP addressDNSname
For each server.
Partner works from mirror to principal, but not vice versa.
We were having problems setting up the mirroring, so I did it via command lines. I found out the "alter...set partnership" command works on the mirror server going to the principal, but gets a 1418 error when going from the principal to the mirror.
So if A is the principal and B is the mirror, A to B fails but B to A works.
If I reverse it so that B is the principal and A is the mirror, B to A fails and A to B works.
Any suggestions?
Here’s an update on our problem.
We are now doing it thru Management Studio. We set up the mirroring, but answer “no” when it asks to start mirroring and go back to the mirroring screen. One of the default names contains the domain but the other does not.
We replace the address field with the IP addresses for the Principal and Mirror Network Addresses (no witness). When we click on “start mirroring”, the Principal’s name gets changed back to the dns name, but the mirror name remains an IP address. This is true even when we switch which server is the principal and which the mirror.
It seems to me that because it always happens the same way for the mirror and principal addresses, regardless of the server, that this might be a bug.
|||Fixed it!
We did two things:
- Went to C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\MachineKeys and set the administrators permission to Full Control and
- Edited the C:\WINDOWS\system32\drivers\etc\hosts file on each server to include
IP addressDNSname
For each server.