Friday, March 9, 2012
Error! Must declare the varaible
Can someone help me with the following problem? I have a report that needs
two parameters at runtime. If I execute this report on the same server as RS
with a data source that is connected to a database on the same server as the
RS server. Then the report execute without any problems.
The setup is as follow:
SQL 2000 running on Windows 2003 Server, with XP Professional
workstations connecting to the RS.There is also three other SQL 2000 servers
running on Windows 2003 Server.
The problem occurs when the Data Source points to a database on a separate
server than the RS server. In this scenario the report executes with an
Error.
An error has occurred during report processing. (rsProcessingAborted) Get
Online Help
Query execution failed for data set 'SRCC'. (rsErrorExecutingCommand) Get
Online Help
Must declare the variable '@.PCode'.
If the report contains no parameters, it executes without any error. Only if
it contains parameters does it execute with an error. If someone can tell me
why this is happening I will really appreciate it.
Thanx
MVAHi,
Have you done anything like this in thr Data tab.
set @.ecode = 1002
select * from employee where empno = @.ecode
Then you will get the error. If you can share the full query with dummy
values that's well and good. If you get "must declare @.pcode" then it must be
something to do with the query and I hope you didnt give anywhere in the
report "@.pcode". In that case you may get this error.
Amarnath.
"MVA" wrote:
> Hi
> Can someone help me with the following problem? I have a report that needs
> two parameters at runtime. If I execute this report on the same server as RS
> with a data source that is connected to a database on the same server as the
> RS server. Then the report execute without any problems.
> The setup is as follow:
> SQL 2000 running on Windows 2003 Server, with XP Professional
> workstations connecting to the RS.There is also three other SQL 2000 servers
> running on Windows 2003 Server.
> The problem occurs when the Data Source points to a database on a separate
> server than the RS server. In this scenario the report executes with an
> Error.
>
> An error has occurred during report processing. (rsProcessingAborted) Get
> Online Help
> Query execution failed for data set 'SRCC'. (rsErrorExecutingCommand) Get
> Online Help
> Must declare the variable '@.PCode'.
>
> If the report contains no parameters, it executes without any error. Only if
> it contains parameters does it execute with an error. If someone can tell me
> why this is happening I will really appreciate it.
>
> Thanx
> MVA
>
>
Wednesday, March 7, 2012
error with rs.exe utility
Here is my script:
***********************************************************
' File: RunReport.rss
Dim format as string = "Excel"
Dim fileName as String = "C:\Export2.xls"
Dim reportPath as String = "/APSAgentCourseCompletionByUserGroup"
Public Sub Main()
' 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 = "ms-excel"
Dim warnings() AS Warning = Nothing
Dim reportHistoryParameters() As ParameterValue = Nothing
Dim streamIDs() as string = Nothing
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
' Report Parameters
Dim parameters(5) As ParameterValue
parameters(0) = New ParameterValue()
parameters(0).Name = "User Group"
parameters(0).Value = "66179312-f341-4df7-a855-79c5b8abaf9f"
parameters(1) = New ParameterValue()
parameters(1).Name = "Start Date"
parameters(1).Value = "12/22/2006"
parameters(2) = New ParameterValue()
parameters(2).Name = "End Date"
parameters(2).Value = "2/17/2007"
parameters(3) = New ParameterValue()
parameters(3).Name = "Course Name"
parameters(3).Value = "AA2B1AA0-E78A-4F84-834F-8EAAB75BEBD3"
parameters(4) = New ParameterValue()
parameters(4).Name = "Status To Include"
parameters(4).Value = "0"
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
'End of script
***********************************************************
As you can see, right now I've got all 5 report parameters hard-coded.
Here is the command line that I'm using as well as the error that I receive:
rs.exe -i c:\RunReport.rss -s http://localhost/reportserver -t
Unhandled exception: The value of parameter 'Parameters' is not valid. Check the documentation for information about valid values.
Any insight that anyone can provide is greatly appreciated.
Thanks!
Raywhat...? no response to this yet? i'm desperately seeking samples for
how to use this rs.exe utility, and there's just not enough out there.
a comprehensive tutorial would be nice too actually; but thats just a dream at this point.
|||Yeah, i was really hoping that someone would respond to it as well, but luckily i stumbled upon my own solution. The error that I was receiving was because the array I initialized was incremented by too much. Instead of
Dim parameters(5) As ParameterValue
it should have been:
Dim parameters(4) As ParameterValue
Once I made that change the script was executing just fine!
Hope this helps you somewhat. Are you receiving other errors?
error with rs.exe utility
Here is my script:
***********************************************************
' File: RunReport.rss
Dim format as string = "Excel"
Dim fileName as String = "C:\Export2.xls"
Dim reportPath as String = "/APSAgentCourseCompletionByUserGroup"
Public Sub Main()
' 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 = "ms-excel"
Dim warnings() AS Warning = Nothing
Dim reportHistoryParameters() As ParameterValue = Nothing
Dim streamIDs() as string = Nothing
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
' Report Parameters
Dim parameters(5) As ParameterValue
parameters(0) = New ParameterValue()
parameters(0).Name = "User Group"
parameters(0).Value = "66179312-f341-4df7-a855-79c5b8abaf9f"
parameters(1) = New ParameterValue()
parameters(1).Name = "Start Date"
parameters(1).Value = "12/22/2006"
parameters(2) = New ParameterValue()
parameters(2).Name = "End Date"
parameters(2).Value = "2/17/2007"
parameters(3) = New ParameterValue()
parameters(3).Name = "Course Name"
parameters(3).Value = "AA2B1AA0-E78A-4F84-834F-8EAAB75BEBD3"
parameters(4) = New ParameterValue()
parameters(4).Name = "Status To Include"
parameters(4).Value = "0"
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
'End of script
***********************************************************
As you can see, right now I've got all 5 report parameters hard-coded.
Here is the command line that I'm using as well as the error that I receive:
rs.exe -i c:\RunReport.rss -s http://localhost/reportserver -t
Unhandled exception: The value of parameter 'Parameters' is not valid. Check the documentation for information about valid values.
Any insight that anyone can provide is greatly appreciated.
Thanks!
Ray
what...? no response to this yet? i'm desperately seeking samples for
how to use this rs.exe utility, and there's just not enough out there.
a comprehensive tutorial would be nice too actually; but thats just a dream at this point.
|||Yeah, i was really hoping that someone would respond to it as well, but luckily i stumbled upon my own solution. The error that I was receiving was because the array I initialized was incremented by too much. Instead of
Dim parameters(5) As ParameterValue
it should have been:
Dim parameters(4) As ParameterValue
Once I made that change the script was executing just fine!
Hope this helps you somewhat. Are you receiving other errors?