Friday, March 23, 2012

How can I pass parameters into an RSS file for RS.EXE

I have a stored proc running:
Declare @.cmd nvarchar(255)
Set @.cmd = 'C:\Program Files\Microsoft SQL Server\80\Tools\Binn>rs -i
"C:\CmdLineReportRendering.rss" -s http://localhost/reportserver
exec master..xp_cmdshell @.cmd
But, the report the RSS file will render has 3 parameters the user specifies.
I know I can easily pass parameters to the command line from my stored proc,
but can I pass parameters from the command line into the RSS file like I can
do with a batch file?the syntax is
-v parameter1Name="parameterValue"
This posting is provided "AS IS" with no warranties, and confers no rights.
"AdamB" <AdamB@.discussions.microsoft.com> wrote in message
news:807422F1-C259-4D8D-9035-8492E6EA9BDD@.microsoft.com...
>I have a stored proc running:
> Declare @.cmd nvarchar(255)
> Set @.cmd = 'C:\Program Files\Microsoft SQL Server\80\Tools\Binn>rs -i
> "C:\CmdLineReportRendering.rss" -s http://localhost/reportserver
> exec master..xp_cmdshell @.cmd
> But, the report the RSS file will render has 3 parameters the user
> specifies.
> I know I can easily pass parameters to the command line from my stored
> proc,
> but can I pass parameters from the command line into the RSS file like I
> can
> do with a batch file?|||You should not declare PID, RID and RptName in the script.
What happens if you run same command from command window?
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"AdamB" <AdamB@.discussions.microsoft.com> wrote in message
news:98ECCF1E-42B9-4C63-895B-900210FD82CB@.microsoft.com...
> So then how do I use these parameters in the RSS file?
> I already have an array of parameters like this:
> ' Report Parameters
> Dim parameters(2) As ParameterValue
> parameters(0) = New ParameterValue()
> parameters(0).Name = "PID"
> parameters(0).Value = PID
> parameters(1) = New ParameterValue()
> parameters(1).Name = "RID"
> parameters(1).Value = RID
> parameters(2) = New ParameterValue()
> parameters(2).Name = "Name"
> parameters(2).Value = RptName
>
> PID, RID, and RptName are being passed to the RSS file as Global Variables
> from the command line using -v but when I run this, I get error BC30451
> (variable not declared).
> If I add:
> Dim PID as integer
> Dim RID as integer
> Dim RptName as string
> I get "Unhandled Exception. An error has occured during report
> processing".
>
> "Lev Semenets [MSFT]" wrote:
>> the syntax is
>> -v parameter1Name="parameterValue"
>>
>> --
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>>
>> "AdamB" <AdamB@.discussions.microsoft.com> wrote in message
>> news:807422F1-C259-4D8D-9035-8492E6EA9BDD@.microsoft.com...
>> >I have a stored proc running:
>> >
>> > Declare @.cmd nvarchar(255)
>> > Set @.cmd = 'C:\Program Files\Microsoft SQL Server\80\Tools\Binn>rs -i
>> > "C:\CmdLineReportRendering.rss" -s http://localhost/reportserver
>> >
>> > exec master..xp_cmdshell @.cmd
>> >
>> > But, the report the RSS file will render has 3 parameters the user
>> > specifies.
>> >
>> > I know I can easily pass parameters to the command line from my stored
>> > proc,
>> > but can I pass parameters from the command line into the RSS file like
>> > I
>> > can
>> > do with a batch file?
>>|||Here is what I run from the command line:
rs -i "C:\pbs\gourmetdining\FlexPlan.rss" -s http://ibm1pbs001/reportserver
-v PID=3 RID=1 RptName="NJIT Flex Plan Report"
Here is the content of FlexPlan.rss:
Public Sub Main()
Dim format as string = "PDF"
Dim fileName as String = "C:\PBS\GourmetDining\FlexPlanReport.pdf"
Dim reportPath as String = "/Customers/Gourmet_Dining/Flex Plan Report"
' Prepare Render arguments
Dim historyID as string = Nothing
Dim deviceInfo as string = Nothing
Dim showHide as string = Nothing
Dim results() as Byte
Dim encoding as string
Dim mimeType as string
Dim warnings() AS Warning = Nothing
Dim reportHistoryParameters() As ParameterValue = Nothing
Dim streamIDs() as string = Nothing
' Report Parameters
Dim parameters(2) As ParameterValue
parameters(0) = New ParameterValue()
parameters(0).Name = "PID"
parameters(0).Value = PID
parameters(1) = New ParameterValue()
parameters(1).Name = "RID"
parameters(1).Value = RID
parameters(2) = New ParameterValue()
parameters(2).Name = "Name"
parameters(2).Value = RptName
results = rs.Render(reportPath, format, _
Nothing, Nothing, parameters, _
Nothing, Nothing, encoding, mimeType, _
reportHistoryParameters, warnings, streamIDs)
' Open a file stream and write out the report
Dim stream As FileStream = File.OpenWrite(fileName)
stream.Write(results, 0, results.Length)
stream.Close()
End Sub
And the error I get when I execute the above command line code is:
The specified script failed to compile with the following errors:
C:\Documents and Settings\adam.baruh>
"c:\winnt\microsoft.net\framework\v1.1.4322\vbc.exe" /t:exe /main:MainModule
/utf8output /R:"System.dll" /R:"System.Xml.dll" /R:"System.Web.Services.dll"
/R:"C:\Program Files\Microsoft SQL Server\80\Tools\BINN\RS.exe"
/out:"C:\DOCUME~1\ADAM~1.BAR\LOCALS~1\Temp\1\kzf4n1yz.exe" /debug-
"C:\DOCUME~1\ADAM~1.BAR\LOCALS~1\Temp\1\kzf4n1yz.0.vb"
"C:\DOCUME~1\ADAM~1.BAR\LOCALS~1\Temp\1\kzf4n1yz.1.vb"
Microsoft (R) Visual Basic .NET Compiler version 7.10.3052.4
for Microsoft (R) .NET Framework version 1.1.4322.573
Copyright (C) Microsoft Corporation 1987-2002. All rights reserved.
C:\DOCUME~1\ADAM~1.BAR\LOCALS~1\Temp\1\kzf4n1yz.1.vb(40) : error BC30451:
Name 'RID' is not declared.
parameters(1).Value = RID
~~~
C:\DOCUME~1\ADAM~1.BAR\LOCALS~1\Temp\1\kzf4n1yz.1.vb(44) : error BC30451:
Name 'RptName' is not declared.
parameters(2).Value = RptName
"Lev Semenets [MSFT]" wrote:
> You should not declare PID, RID and RptName in the script.
> What happens if you run same command from command window?
> --
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "AdamB" <AdamB@.discussions.microsoft.com> wrote in message
> news:98ECCF1E-42B9-4C63-895B-900210FD82CB@.microsoft.com...
> > So then how do I use these parameters in the RSS file?
> >
> > I already have an array of parameters like this:
> >
> > ' Report Parameters
> > Dim parameters(2) As ParameterValue
> > parameters(0) = New ParameterValue()
> > parameters(0).Name = "PID"
> > parameters(0).Value = PID
> >
> > parameters(1) = New ParameterValue()
> > parameters(1).Name = "RID"
> > parameters(1).Value = RID
> >
> > parameters(2) = New ParameterValue()
> > parameters(2).Name = "Name"
> > parameters(2).Value = RptName
> >
> >
> > PID, RID, and RptName are being passed to the RSS file as Global Variables
> > from the command line using -v but when I run this, I get error BC30451
> > (variable not declared).
> >
> > If I add:
> > Dim PID as integer
> > Dim RID as integer
> > Dim RptName as string
> >
> > I get "Unhandled Exception. An error has occured during report
> > processing".
> >
> >
> >
> > "Lev Semenets [MSFT]" wrote:
> >
> >> the syntax is
> >> -v parameter1Name="parameterValue"
> >>
> >>
> >> --
> >> This posting is provided "AS IS" with no warranties, and confers no
> >> rights.
> >>
> >>
> >> "AdamB" <AdamB@.discussions.microsoft.com> wrote in message
> >> news:807422F1-C259-4D8D-9035-8492E6EA9BDD@.microsoft.com...
> >> >I have a stored proc running:
> >> >
> >> > Declare @.cmd nvarchar(255)
> >> > Set @.cmd = 'C:\Program Files\Microsoft SQL Server\80\Tools\Binn>rs -i
> >> > "C:\CmdLineReportRendering.rss" -s http://localhost/reportserver
> >> >
> >> > exec master..xp_cmdshell @.cmd
> >> >
> >> > But, the report the RSS file will render has 3 parameters the user
> >> > specifies.
> >> >
> >> > I know I can easily pass parameters to the command line from my stored
> >> > proc,
> >> > but can I pass parameters from the command line into the RSS file like
> >> > I
> >> > can
> >> > do with a batch file?
> >>
> >>
> >>
>
>|||Please use separate -v option for every parameter:
-v PID=1 -v RID=1 -v RptName="NJIT Flex Plan Report"
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"AdamB" <AdamB@.discussions.microsoft.com> wrote in message
news:199317DB-4D61-4247-B719-3D982DA2169A@.microsoft.com...
> Here is what I run from the command line:
> rs -i "C:\pbs\gourmetdining\FlexPlan.rss" -s
> http://ibm1pbs001/reportserver
> -v PID=3 RID=1 RptName="NJIT Flex Plan Report"
>
> Here is the content of FlexPlan.rss:
> Public Sub Main()
> Dim format as string = "PDF"
> Dim fileName as String = "C:\PBS\GourmetDining\FlexPlanReport.pdf"
> Dim reportPath as String = "/Customers/Gourmet_Dining/Flex Plan Report"
> ' Prepare Render arguments
> Dim historyID as string = Nothing
> Dim deviceInfo as string = Nothing
> Dim showHide as string = Nothing
> Dim results() as Byte
> Dim encoding as string
> Dim mimeType as string
> Dim warnings() AS Warning = Nothing
> Dim reportHistoryParameters() As ParameterValue = Nothing
> Dim streamIDs() as string = Nothing
> ' Report Parameters
> Dim parameters(2) As ParameterValue
> parameters(0) = New ParameterValue()
> parameters(0).Name = "PID"
> parameters(0).Value = PID
> parameters(1) = New ParameterValue()
> parameters(1).Name = "RID"
> parameters(1).Value = RID
> parameters(2) = New ParameterValue()
> parameters(2).Name = "Name"
> parameters(2).Value = RptName
> results = rs.Render(reportPath, format, _
> Nothing, Nothing, parameters, _
> Nothing, Nothing, encoding, mimeType, _
> reportHistoryParameters, warnings, streamIDs)
> ' Open a file stream and write out the report
> Dim stream As FileStream = File.OpenWrite(fileName)
> stream.Write(results, 0, results.Length)
> stream.Close()
> End Sub
> And the error I get when I execute the above command line code is:
> The specified script failed to compile with the following errors:
> C:\Documents and Settings\adam.baruh>
> "c:\winnt\microsoft.net\framework\v1.1.4322\vbc.exe" /t:exe
> /main:MainModule
> /utf8output /R:"System.dll" /R:"System.Xml.dll"
> /R:"System.Web.Services.dll"
> /R:"C:\Program Files\Microsoft SQL Server\80\Tools\BINN\RS.exe"
> /out:"C:\DOCUME~1\ADAM~1.BAR\LOCALS~1\Temp\1\kzf4n1yz.exe" /debug-
> "C:\DOCUME~1\ADAM~1.BAR\LOCALS~1\Temp\1\kzf4n1yz.0.vb"
> "C:\DOCUME~1\ADAM~1.BAR\LOCALS~1\Temp\1\kzf4n1yz.1.vb"
> Microsoft (R) Visual Basic .NET Compiler version 7.10.3052.4
> for Microsoft (R) .NET Framework version 1.1.4322.573
> Copyright (C) Microsoft Corporation 1987-2002. All rights reserved.
> C:\DOCUME~1\ADAM~1.BAR\LOCALS~1\Temp\1\kzf4n1yz.1.vb(40) : error BC30451:
> Name 'RID' is not declared.
> parameters(1).Value = RID
> ~~~
> C:\DOCUME~1\ADAM~1.BAR\LOCALS~1\Temp\1\kzf4n1yz.1.vb(44) : error BC30451:
> Name 'RptName' is not declared.
> parameters(2).Value = RptName
> "Lev Semenets [MSFT]" wrote:
>> You should not declare PID, RID and RptName in the script.
>> What happens if you run same command from command window?
>> --
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>>
>> "AdamB" <AdamB@.discussions.microsoft.com> wrote in message
>> news:98ECCF1E-42B9-4C63-895B-900210FD82CB@.microsoft.com...
>> > So then how do I use these parameters in the RSS file?
>> >
>> > I already have an array of parameters like this:
>> >
>> > ' Report Parameters
>> > Dim parameters(2) As ParameterValue
>> > parameters(0) = New ParameterValue()
>> > parameters(0).Name = "PID"
>> > parameters(0).Value = PID
>> >
>> > parameters(1) = New ParameterValue()
>> > parameters(1).Name = "RID"
>> > parameters(1).Value = RID
>> >
>> > parameters(2) = New ParameterValue()
>> > parameters(2).Name = "Name"
>> > parameters(2).Value = RptName
>> >
>> >
>> > PID, RID, and RptName are being passed to the RSS file as Global
>> > Variables
>> > from the command line using -v but when I run this, I get error BC30451
>> > (variable not declared).
>> >
>> > If I add:
>> > Dim PID as integer
>> > Dim RID as integer
>> > Dim RptName as string
>> >
>> > I get "Unhandled Exception. An error has occured during report
>> > processing".
>> >
>> >
>> >
>> > "Lev Semenets [MSFT]" wrote:
>> >
>> >> the syntax is
>> >> -v parameter1Name="parameterValue"
>> >>
>> >>
>> >> --
>> >> This posting is provided "AS IS" with no warranties, and confers no
>> >> rights.
>> >>
>> >>
>> >> "AdamB" <AdamB@.discussions.microsoft.com> wrote in message
>> >> news:807422F1-C259-4D8D-9035-8492E6EA9BDD@.microsoft.com...
>> >> >I have a stored proc running:
>> >> >
>> >> > Declare @.cmd nvarchar(255)
>> >> > Set @.cmd = 'C:\Program Files\Microsoft SQL
>> >> > Server\80\Tools\Binn>rs -i
>> >> > "C:\CmdLineReportRendering.rss" -s http://localhost/reportserver
>> >> >
>> >> > exec master..xp_cmdshell @.cmd
>> >> >
>> >> > But, the report the RSS file will render has 3 parameters the user
>> >> > specifies.
>> >> >
>> >> > I know I can easily pass parameters to the command line from my
>> >> > stored
>> >> > proc,
>> >> > but can I pass parameters from the command line into the RSS file
>> >> > like
>> >> > I
>> >> > can
>> >> > do with a batch file?
>> >>
>> >>
>> >>
>>|||Gotta love those easy answers. I wish the documentation was a bit more clear
on this utility though. Would love even more if there were samples without
having to install the samples on my Report Server. Thanks for the help
though!
"Lev Semenets [MSFT]" wrote:
> Please use separate -v option for every parameter:
> -v PID=1 -v RID=1 -v RptName="NJIT Flex Plan Report"
> --
> This posting is provided "AS IS" with no warranties, and confers no rights.
> "AdamB" <AdamB@.discussions.microsoft.com> wrote in message
> news:199317DB-4D61-4247-B719-3D982DA2169A@.microsoft.com...
> > Here is what I run from the command line:
> >
> > rs -i "C:\pbs\gourmetdining\FlexPlan.rss" -s
> > http://ibm1pbs001/reportserver
> > -v PID=3 RID=1 RptName="NJIT Flex Plan Report"
> >
> >
> > Here is the content of FlexPlan.rss:
> >
> > Public Sub Main()
> >
> > Dim format as string = "PDF"
> > Dim fileName as String = "C:\PBS\GourmetDining\FlexPlanReport.pdf"
> > Dim reportPath as String = "/Customers/Gourmet_Dining/Flex Plan Report"
> >
> > ' Prepare Render arguments
> > Dim historyID as string = Nothing
> > Dim deviceInfo as string = Nothing
> > Dim showHide as string = Nothing
> > Dim results() as Byte
> > Dim encoding as string
> > Dim mimeType as string
> > Dim warnings() AS Warning = Nothing
> > Dim reportHistoryParameters() As ParameterValue = Nothing
> > Dim streamIDs() as string = Nothing
> >
> > ' Report Parameters
> > Dim parameters(2) As ParameterValue
> > parameters(0) = New ParameterValue()
> > parameters(0).Name = "PID"
> > parameters(0).Value = PID
> >
> > parameters(1) = New ParameterValue()
> > parameters(1).Name = "RID"
> > parameters(1).Value = RID
> >
> > parameters(2) = New ParameterValue()
> > parameters(2).Name = "Name"
> > parameters(2).Value = RptName
> >
> > results = rs.Render(reportPath, format, _
> > Nothing, Nothing, parameters, _
> > Nothing, Nothing, encoding, mimeType, _
> > reportHistoryParameters, warnings, streamIDs)
> >
> > ' Open a file stream and write out the report
> > Dim stream As FileStream = File.OpenWrite(fileName)
> > stream.Write(results, 0, results.Length)
> > stream.Close()
> > End Sub
> >
> > And the error I get when I execute the above command line code is:
> >
> > The specified script failed to compile with the following errors:
> > C:\Documents and Settings\adam.baruh>
> > "c:\winnt\microsoft.net\framework\v1.1.4322\vbc.exe" /t:exe
> > /main:MainModule
> > /utf8output /R:"System.dll" /R:"System.Xml.dll"
> > /R:"System.Web.Services.dll"
> > /R:"C:\Program Files\Microsoft SQL Server\80\Tools\BINN\RS.exe"
> > /out:"C:\DOCUME~1\ADAM~1.BAR\LOCALS~1\Temp\1\kzf4n1yz.exe" /debug-
> > "C:\DOCUME~1\ADAM~1.BAR\LOCALS~1\Temp\1\kzf4n1yz.0.vb"
> > "C:\DOCUME~1\ADAM~1.BAR\LOCALS~1\Temp\1\kzf4n1yz.1.vb"
> >
> > Microsoft (R) Visual Basic .NET Compiler version 7.10.3052.4
> > for Microsoft (R) .NET Framework version 1.1.4322.573
> > Copyright (C) Microsoft Corporation 1987-2002. All rights reserved.
> >
> > C:\DOCUME~1\ADAM~1.BAR\LOCALS~1\Temp\1\kzf4n1yz.1.vb(40) : error BC30451:
> > Name 'RID' is not declared.
> >
> > parameters(1).Value = RID
> > ~~~
> > C:\DOCUME~1\ADAM~1.BAR\LOCALS~1\Temp\1\kzf4n1yz.1.vb(44) : error BC30451:
> > Name 'RptName' is not declared.
> >
> > parameters(2).Value = RptName
> >
> > "Lev Semenets [MSFT]" wrote:
> >
> >> You should not declare PID, RID and RptName in the script.
> >> What happens if you run same command from command window?
> >>
> >> --
> >> This posting is provided "AS IS" with no warranties, and confers no
> >> rights.
> >>
> >>
> >> "AdamB" <AdamB@.discussions.microsoft.com> wrote in message
> >> news:98ECCF1E-42B9-4C63-895B-900210FD82CB@.microsoft.com...
> >> > So then how do I use these parameters in the RSS file?
> >> >
> >> > I already have an array of parameters like this:
> >> >
> >> > ' Report Parameters
> >> > Dim parameters(2) As ParameterValue
> >> > parameters(0) = New ParameterValue()
> >> > parameters(0).Name = "PID"
> >> > parameters(0).Value = PID
> >> >
> >> > parameters(1) = New ParameterValue()
> >> > parameters(1).Name = "RID"
> >> > parameters(1).Value = RID
> >> >
> >> > parameters(2) = New ParameterValue()
> >> > parameters(2).Name = "Name"
> >> > parameters(2).Value = RptName
> >> >
> >> >
> >> > PID, RID, and RptName are being passed to the RSS file as Global
> >> > Variables
> >> > from the command line using -v but when I run this, I get error BC30451
> >> > (variable not declared).
> >> >
> >> > If I add:
> >> > Dim PID as integer
> >> > Dim RID as integer
> >> > Dim RptName as string
> >> >
> >> > I get "Unhandled Exception. An error has occured during report
> >> > processing".
> >> >
> >> >
> >> >
> >> > "Lev Semenets [MSFT]" wrote:
> >> >
> >> >> the syntax is
> >> >> -v parameter1Name="parameterValue"
> >> >>
> >> >>
> >> >> --
> >> >> This posting is provided "AS IS" with no warranties, and confers no
> >> >> rights.
> >> >>
> >> >>
> >> >> "AdamB" <AdamB@.discussions.microsoft.com> wrote in message
> >> >> news:807422F1-C259-4D8D-9035-8492E6EA9BDD@.microsoft.com...
> >> >> >I have a stored proc running:
> >> >> >
> >> >> > Declare @.cmd nvarchar(255)
> >> >> > Set @.cmd = 'C:\Program Files\Microsoft SQL
> >> >> > Server\80\Tools\Binn>rs -i
> >> >> > "C:\CmdLineReportRendering.rss" -s http://localhost/reportserver
> >> >> >
> >> >> > exec master..xp_cmdshell @.cmd
> >> >> >
> >> >> > But, the report the RSS file will render has 3 parameters the user
> >> >> > specifies.
> >> >> >
> >> >> > I know I can easily pass parameters to the command line from my
> >> >> > stored
> >> >> > proc,
> >> >> > but can I pass parameters from the command line into the RSS file
> >> >> > like
> >> >> > I
> >> >> > can
> >> >> > do with a batch file?
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>
>
>|||That is documentation bug.
You may find some scripts here: http://blogs.msdn.com/bryanke/
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"AdamB" <AdamB@.discussions.microsoft.com> wrote in message
news:936D34E0-3E68-4C38-871E-BA738D2147D9@.microsoft.com...
> Gotta love those easy answers. I wish the documentation was a bit more
> clear
> on this utility though. Would love even more if there were samples
> without
> having to install the samples on my Report Server. Thanks for the help
> though!
> "Lev Semenets [MSFT]" wrote:
>> Please use separate -v option for every parameter:
>> -v PID=1 -v RID=1 -v RptName="NJIT Flex Plan Report"
>> --
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>> "AdamB" <AdamB@.discussions.microsoft.com> wrote in message
>> news:199317DB-4D61-4247-B719-3D982DA2169A@.microsoft.com...
>> > Here is what I run from the command line:
>> >
>> > rs -i "C:\pbs\gourmetdining\FlexPlan.rss" -s
>> > http://ibm1pbs001/reportserver
>> > -v PID=3 RID=1 RptName="NJIT Flex Plan Report"
>> >
>> >
>> > Here is the content of FlexPlan.rss:
>> >
>> > Public Sub Main()
>> >
>> > Dim format as string = "PDF"
>> > Dim fileName as String = "C:\PBS\GourmetDining\FlexPlanReport.pdf"
>> > Dim reportPath as String = "/Customers/Gourmet_Dining/Flex Plan
>> > Report"
>> >
>> > ' Prepare Render arguments
>> > Dim historyID as string = Nothing
>> > Dim deviceInfo as string = Nothing
>> > Dim showHide as string = Nothing
>> > Dim results() as Byte
>> > Dim encoding as string
>> > Dim mimeType as string
>> > Dim warnings() AS Warning = Nothing
>> > Dim reportHistoryParameters() As ParameterValue = Nothing
>> > Dim streamIDs() as string = Nothing
>> >
>> > ' Report Parameters
>> > Dim parameters(2) As ParameterValue
>> > parameters(0) = New ParameterValue()
>> > parameters(0).Name = "PID"
>> > parameters(0).Value = PID
>> >
>> > parameters(1) = New ParameterValue()
>> > parameters(1).Name = "RID"
>> > parameters(1).Value = RID
>> >
>> > parameters(2) = New ParameterValue()
>> > parameters(2).Name = "Name"
>> > parameters(2).Value = RptName
>> >
>> > results = rs.Render(reportPath, format, _
>> > Nothing, Nothing, parameters, _
>> > Nothing, Nothing, encoding, mimeType, _
>> > reportHistoryParameters, warnings, streamIDs)
>> >
>> > ' Open a file stream and write out the report
>> > Dim stream As FileStream = File.OpenWrite(fileName)
>> > stream.Write(results, 0, results.Length)
>> > stream.Close()
>> > End Sub
>> >
>> > And the error I get when I execute the above command line code is:
>> >
>> > The specified script failed to compile with the following errors:
>> > C:\Documents and Settings\adam.baruh>
>> > "c:\winnt\microsoft.net\framework\v1.1.4322\vbc.exe" /t:exe
>> > /main:MainModule
>> > /utf8output /R:"System.dll" /R:"System.Xml.dll"
>> > /R:"System.Web.Services.dll"
>> > /R:"C:\Program Files\Microsoft SQL Server\80\Tools\BINN\RS.exe"
>> > /out:"C:\DOCUME~1\ADAM~1.BAR\LOCALS~1\Temp\1\kzf4n1yz.exe" /debug-
>> > "C:\DOCUME~1\ADAM~1.BAR\LOCALS~1\Temp\1\kzf4n1yz.0.vb"
>> > "C:\DOCUME~1\ADAM~1.BAR\LOCALS~1\Temp\1\kzf4n1yz.1.vb"
>> >
>> > Microsoft (R) Visual Basic .NET Compiler version 7.10.3052.4
>> > for Microsoft (R) .NET Framework version 1.1.4322.573
>> > Copyright (C) Microsoft Corporation 1987-2002. All rights reserved.
>> >
>> > C:\DOCUME~1\ADAM~1.BAR\LOCALS~1\Temp\1\kzf4n1yz.1.vb(40) : error
>> > BC30451:
>> > Name 'RID' is not declared.
>> >
>> > parameters(1).Value = RID
>> > ~~~
>> > C:\DOCUME~1\ADAM~1.BAR\LOCALS~1\Temp\1\kzf4n1yz.1.vb(44) : error
>> > BC30451:
>> > Name 'RptName' is not declared.
>> >
>> > parameters(2).Value = RptName
>> >
>> > "Lev Semenets [MSFT]" wrote:
>> >
>> >> You should not declare PID, RID and RptName in the script.
>> >> What happens if you run same command from command window?
>> >>
>> >> --
>> >> This posting is provided "AS IS" with no warranties, and confers no
>> >> rights.
>> >>
>> >>
>> >> "AdamB" <AdamB@.discussions.microsoft.com> wrote in message
>> >> news:98ECCF1E-42B9-4C63-895B-900210FD82CB@.microsoft.com...
>> >> > So then how do I use these parameters in the RSS file?
>> >> >
>> >> > I already have an array of parameters like this:
>> >> >
>> >> > ' Report Parameters
>> >> > Dim parameters(2) As ParameterValue
>> >> > parameters(0) = New ParameterValue()
>> >> > parameters(0).Name = "PID"
>> >> > parameters(0).Value = PID
>> >> >
>> >> > parameters(1) = New ParameterValue()
>> >> > parameters(1).Name = "RID"
>> >> > parameters(1).Value = RID
>> >> >
>> >> > parameters(2) = New ParameterValue()
>> >> > parameters(2).Name = "Name"
>> >> > parameters(2).Value = RptName
>> >> >
>> >> >
>> >> > PID, RID, and RptName are being passed to the RSS file as Global
>> >> > Variables
>> >> > from the command line using -v but when I run this, I get error
>> >> > BC30451
>> >> > (variable not declared).
>> >> >
>> >> > If I add:
>> >> > Dim PID as integer
>> >> > Dim RID as integer
>> >> > Dim RptName as string
>> >> >
>> >> > I get "Unhandled Exception. An error has occured during report
>> >> > processing".
>> >> >
>> >> >
>> >> >
>> >> > "Lev Semenets [MSFT]" wrote:
>> >> >
>> >> >> the syntax is
>> >> >> -v parameter1Name="parameterValue"
>> >> >>
>> >> >>
>> >> >> --
>> >> >> This posting is provided "AS IS" with no warranties, and confers no
>> >> >> rights.
>> >> >>
>> >> >>
>> >> >> "AdamB" <AdamB@.discussions.microsoft.com> wrote in message
>> >> >> news:807422F1-C259-4D8D-9035-8492E6EA9BDD@.microsoft.com...
>> >> >> >I have a stored proc running:
>> >> >> >
>> >> >> > Declare @.cmd nvarchar(255)
>> >> >> > Set @.cmd = 'C:\Program Files\Microsoft SQL
>> >> >> > Server\80\Tools\Binn>rs -i
>> >> >> > "C:\CmdLineReportRendering.rss" -s http://localhost/reportserver
>> >> >> >
>> >> >> > exec master..xp_cmdshell @.cmd
>> >> >> >
>> >> >> > But, the report the RSS file will render has 3 parameters the
>> >> >> > user
>> >> >> > specifies.
>> >> >> >
>> >> >> > I know I can easily pass parameters to the command line from my
>> >> >> > stored
>> >> >> > proc,
>> >> >> > but can I pass parameters from the command line into the RSS file
>> >> >> > like
>> >> >> > I
>> >> >> > can
>> >> >> > do with a batch file?
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>>|||In the documentation it says:
For example, -v a="b" c="d" results in a variable named a with a value of
"b" and a variable c with a value of "d".
Not -v a="b" -v c="d" >> which by the way does not work!
Somebody please change the documentation!!!
"Lev Semenets [MSFT]" wrote:
> Please use separate -v option for every parameter:
> -v PID=1 -v RID=1 -v RptName="NJIT Flex Plan Report"
> --

No comments:

Post a Comment