Showing posts with label returned. Show all posts
Showing posts with label returned. Show all posts

Friday, March 23, 2012

image resource returned in code

I'm trying to display an image that has been returned from an external assembly, but am having no luck at all.

Essentially, I have a utility class that goes to a resource file and pulls out a JPG and returns it. I have set the value property of the image control on the report to hit this assembly, like so :

= Code.getLogo()

where the function Code.getLogo() actually interfaces with the utility class.

I have tried several variations of this code. I have returned the image as an Image object, a JPG, a TIFF and a BMP. I've also been adventurous and tried converting it to a base64 string before it gets to the report and then having the report convert it back to bytes before shoving it into the image value. Consistently I get this error :

The value expression used in image ‘logo’ returned a data type that is not valid.

A reply to a similar post on the www.sqlreportingservices.net site suggested that it's a Code Access Security issue, but I'm sure it's not, because when I dump my base64 string into a text field, it fills half the page.

What is this control expecting? Any thoughts?

Have you tried setting Image.Source to Database? If you specify Embedded, the value of Value is the resource's name embedded in the report, not the image's binary data. If you specify External, it is expecting a URL path to the image. Specifying Database indicates that the image contents is coming from a database field and Value is then the image's binary data. It's not actually coming from the database in your case, but Image should interpret the Value properly all the same.|||

Yes, I did indeed have it set to Embedded.

When I set to Database, I have a whole new set of errors, but they seem more straightforward. I'll fiddle with it for a while and see what I can come up with.

Got me over a big hurdle. Thanks.

|||Next you'll want to make sure your MIMEType is set correctly. If you're returning JPEG data, you want to set your MIMEType to image/jpeg. If you have a mismatch, it will try to interpret your JPEG as a BMP (i.e. MIMEType = image/bmp) rather than the JPEG that it actually is.|||

Your function has to return the image as byte array (i.e. byte[]). In addition, the image type has to be set to "Database", otherwise the Value property is not interpreted as the actual image data.

--Robert

|||Awesome, it worked. When I changed my Source property to Database, I also took out my conversion statements so that it would return just an image file. Once I put the conversion-to-byte-array logic back in, it worked.

Thank ye very much for your help.

Wednesday, March 21, 2012

Image for path returned by Query in RDLC & ReportViewer

Anyone know how to add an image to report whose path is returned by
the query?
JasonOn Mar 10, 3:05=A0pm, Jason Wilson <wils...@.ausrad.com> wrote:
> Anyone know how to add an image to report whose path is returned by
> the query?
> Jason
I figured this out, but now I would like to show a tif image. Anyone
know how to do this?sql

Monday, March 12, 2012

Im getting a subquery returned more than 1 value error. Please Help!

The error is occurring in the where clause that I spaced out down below, Its dealing with the State_No I know for a fact. I can't figure out how to run it in the Query anzlyzer to relate to match up with another table

PLEASE HELP!!!!!!

This is the error I'm getting in the DTS package i ran and query analyzer:
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.

Update HBC_Boiler_Inspection
set Safety_Valve_Cap = '" & rs1 ("Safety_Valve_Cap") & "', "
strSQL = strSQL & " Hydro_PSI = '" & rs1 ("Hydro_PSI") & "', "
strSQL = strSQL & " Hydro_Date = '" & rs1 ("Hydro_Date") & "' "

strSQL = strSQL & " where Boiler_ID = (Select ID from HBC_Boiler where State_No = " & rs1 ("State_No") & ") "try

Boiler_ID IN (Select ID from ...

caution: this will update all the boilers selected in the subquery

rudy

Friday, February 24, 2012

IIF Statements

Hi All,

I have a normal IIF statement that controls what text i see in a text box depending on the returned value from the database. This is fine and all is working well.

My question is: Is it possible to have say the first line of the text in bold and a different size to that of the first bit of data?

=IIF(Fields!Code1.Value = "Developed","Developed: " & First(Fields!DevelopedText.Value, "ResourceTexts"),Fields!Code1.Value)

My example above shows this but what i want is the word Developed: to be bold and a different sizer to what follows. is this possible? I'm thinking maybe i have to insert a bold tag maybe?

Any help would be greatly appreciated.

Ta

Dave

No, different formats in the control is not supported. RTF support will be eventually added in later versions.

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de|||http://www.sqlservercentral.com/columnists/bknight/reportingservicesconditionalformatting.asp