Tuesday, March 27, 2012

Embedded Code

I have read several posts but still cannot get to the answer and I
think it is something very basic and simple.
I have one report with embedded code that is running a sqlconnection,
sqlcommand, and sqldatareader to get two different fields from a query
to build a string to return back to the text field in the report. It
works just fine on my developer computer in the Preview mode but when I
deploy to the Report Server, the text field that is using the
referenced code displays a #Error.
I have seen that people pull this data out to a separate Assembly and
can reference it out in other reports, but I am just looking at making
this one report work with embedded code and it seems that I am
overlooking something.
Any help would be appreciated.
JoeI haven't done this but the issue is one of security. It works on your
development environment because you have rights to everything. I don't think
there is any way to do this as code behind. I think you have to create an
assembly so you can give rights to it.
What are you doing, it is possible that you can have another query for an
additional dataset or use a sub report and do this without code.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Joe" <joe.falk@.apptecusa.com> wrote in message
news:1125341439.906488.60130@.o13g2000cwo.googlegroups.com...
>I have read several posts but still cannot get to the answer and I
> think it is something very basic and simple.
> I have one report with embedded code that is running a sqlconnection,
> sqlcommand, and sqldatareader to get two different fields from a query
> to build a string to return back to the text field in the report. It
> works just fine on my developer computer in the Preview mode but when I
> deploy to the Report Server, the text field that is using the
> referenced code displays a #Error.
> I have seen that people pull this data out to a separate Assembly and
> can reference it out in other reports, but I am just looking at making
> this one report work with embedded code and it seems that I am
> overlooking something.
> Any help would be appreciated.
> Joe
>|||What I am trying to do is pull an integer and a true/false value from a
query that has a parameter on it. The report shares the parameter and
let's the report reader select from a list of names that the report
will return data. One of the data pieces I would like to display in a
text field with 4 columns and show a "*" if the T/F is true. I am using
a table object and have a text field with the code in the Report
Properties to pull that data as one block of data. I tried using a List
object but it would only display the data in one long strip instead of
columns. If I can't put code in the report, what good is that function?
Joe|||You can put code in behind the report. What you can't do is violate security
(which accessing the database directly does). If you want to go directly
against the database from code then you have to create an assembly and give
it the correct security assignments.
I think you can do what you want here by dropping a subreport into the field
instead of calling code.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Joe" <joe.falk@.apptecusa.com> wrote in message
news:1125353292.661926.156290@.g47g2000cwa.googlegroups.com...
> What I am trying to do is pull an integer and a true/false value from a
> query that has a parameter on it. The report shares the parameter and
> let's the report reader select from a list of names that the report
> will return data. One of the data pieces I would like to display in a
> text field with 4 columns and show a "*" if the T/F is true. I am using
> a table object and have a text field with the code in the Report
> Properties to pull that data as one block of data. I tried using a List
> object but it would only display the data in one long strip instead of
> columns. If I can't put code in the report, what good is that function?
> Joe
>|||It looks like creating a separate assembly is my best bet then. I wish
that it could be as easy as a subreport, but I cannot seem to get a
string of data rows to fill in anything more than a single column of
data and not a set of 4 or 5 columns by 4 or 5 rows. I have a finite
set of data that I am pulling "Select top 20" and no matter which
object I select, I cannot get it to display in multiple columns.
Thanks for your clarification on the reason why this particular code
will not work in embedded code.
Joe
Bruce L-C [MVP] wrote:
> You can put code in behind the report. What you can't do is violate security
> (which accessing the database directly does). If you want to go directly
> against the database from code then you have to create an assembly and give
> it the correct security assignments.
> I think you can do what you want here by dropping a subreport into the field
> instead of calling code.
>
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
> "Joe" <joe.falk@.apptecusa.com> wrote in message
> news:1125353292.661926.156290@.g47g2000cwa.googlegroups.com...
> > What I am trying to do is pull an integer and a true/false value from a
> > query that has a parameter on it. The report shares the parameter and
> > let's the report reader select from a list of names that the report
> > will return data. One of the data pieces I would like to display in a
> > text field with 4 columns and show a "*" if the T/F is true. I am using
> > a table object and have a text field with the code in the Report
> > Properties to pull that data as one block of data. I tried using a List
> > object but it would only display the data in one long strip instead of
> > columns. If I can't put code in the report, what good is that function?
> >
> > Joe
> >

No comments:

Post a Comment