Friday, March 30, 2012
putting image on Crystal Report
Is there any image/Picture control available
please reply me regarding thisHi!
Followinng is how to load picture in Cr from some path dynamically.
for that you will have to do thid
1. Include Crystal Report Designer in to VB
2. add a picture to Detail section of Report
3. double click Detail seciton and code this
Set Picture1.FormattedPicture = LoadPicture(Filepath)
i have used it with Cr8.5.
Monday, March 26, 2012
Pushing IMAGE from SQL CE onto SQL Server 2000
Hello!
We are trying to use RDA to Push an image field onto SQL Server 2000 from a mobile device, but are having problems. Does anyone have any experience with this? If so, maybe some sample code would be very much appreciated. (We have been struggling with this for a while).
byte[] imagearray = null;
string imagestring = "";
try
{
imagearray = (byte[])SQLCEDr.GetValue(SQLCEDr.GetOrdinal("CapturedImage"));
imagestring = System.Text.Encoding.Default.GetString(imagearray, 0, (imagearray.Length - 1));
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
sParameters = "'" + imagestring + "'" ;
try
{
rda.SubmitSql("EXEC sp_HH_WorkOrder_SuppliesUsed " + sParameters,scon);
}
Thanks,
Andy
Here’s the problem:
imagestring = System.Text.Encoding.Default.GetString(imagearray, 0, (imagearray.Length - 1));
This line would be valid for an array which contains text in the default encoding. But it contains binary image data which would be treated as text, corrupted and lost.
To insert/retrieve binary data you have to use parameterized query. In fact, you should use parameterized queries for everything - would save you lot of troubles with localization (e.g. infamous 10/25/2006 vs. 25.10.2006) and formatting not to mention more secure and better performing code. If you don't know how to use parameters, please look it up on MSDN or search this forum as it's been answered before.
Friday, March 9, 2012
Pull an Image from a Database onto a Report Problems
to accomplish it?
I have a table in SQL 2000 containing two fields "StoredDoc" and
"StoredDocExtension".
The StoredDoc field is a ntext field. the StoredDocExtension is a char
field.
When uploading an image to the database, the image is stored directly in the
StoredDoc field. The file extension for the file is stored in the
StoredDocExtension field.
I want to create a report that will display the image stored in the
StoredDoc field directly on the report at runtime. If possible, I would
also like the MIME/Type property to be set based on the StoredDocExtension
field.
I have been trying to get this to work tonight and all I get is a red x
where the image should be.
Any suggestions?
Thanks,
JWYou can set the MIME/Type property based on a database field using the
Properties tab of the image. I am not sure if thats what is you are
looking for.
Ravi|||I was able to do that, but I am running into problems converting the image,
which is stored as a ntext value in the database to the actual picture, when
the report is run.
I wasn't sure if Reporting services was able to handle that or if you needed
to do something special to get the image to show up.
Thanks for the help.
JW
"Ravi R" <bofobofo@.yahoo.com> wrote in message
news:1110480130.355102.180250@.o13g2000cwo.googlegroups.com...
> You can set the MIME/Type property based on a database field using the
> Properties tab of the image. I am not sure if thats what is you are
> looking for.
> Ravi
>|||Database images have to be byte arrays in Base 64 encoding.
You may want to try this image.Value expression (assuming your images are
not encoded as Ole-Images which is typical for Access databases):
=System.Convert.FromBase64String(Fields!ImageNTextColumn.Value)
-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.
"Jeremy Wright" <jwright@.twostep.com> wrote in message
news:uXGxuMaJFHA.580@.TK2MSFTNGP15.phx.gbl...
>I was able to do that, but I am running into problems converting the image,
> which is stored as a ntext value in the database to the actual picture,
> when
> the report is run.
> I wasn't sure if Reporting services was able to handle that or if you
> needed
> to do something special to get the image to show up.
> Thanks for the help.
> JW
> "Ravi R" <bofobofo@.yahoo.com> wrote in message
> news:1110480130.355102.180250@.o13g2000cwo.googlegroups.com...
>> You can set the MIME/Type property based on a database field using the
>> Properties tab of the image. I am not sure if thats what is you are
>> looking for.
>> Ravi
>