473,413 Members | 1,833 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,413 software developers and data experts.

Crystal Reports Does Not Display BLOB Field Correctly in IBlobField Control Using Crystal Reports for VS.NET 2003

Help!!!

The bitmap I am trying to display in a sample Crystal Report is coming
up with much less quality than the original bitmap.

I have a 300x300 dpi bitmap file that I want to insert at run time into
a Crystal Report. The path to the file is stored in a varchar(100)
field in a table in SQL Server.

The Crystal Report displays the bitmap in the IBlobField object but it
is distorted and its resolution is much less than 300x300 dpi.

I created an .xsd file to represent a strongly typed dataset that was
used in order to design the Crystal Report. The column used to
populate the bitmap is of datatype "base64binary". It is also relevant
to note that the size of the IBlobField column that will be used to
display the bitmap has the same size dimension (3 inches wide x 1 inch
height) as the original bitmap.

The following C# code uses the path to the bitmap file, reads it into a
byte array, and then creates a DataTable that will be the source for
the Crystal Report. The properties of the Crystal Report Viewer
control are set in order to display the report.

Here is the code:

private void Form1_Load(object sender, System.EventArgs e)
{
// read bitmap file into Byte Array
String sPhotoFileName;
byte[] PhotoData;
sPhotoFileName = ConfigurationSettings.AppSettings["PhotoFilePath"] +
@"\Photo.BMP";

if (File.Exists(sPhotoFileName) == true)
{
FileStream fs = new
FileStream(sPhotoFileName,FileMode.Open,FileAccess .Read);

BinaryReader r = new BinaryReader(fs);
PhotoData = r.ReadBytes((int)fs.Length);

r.Close();
fs.Close();
}
else
{
PhotoData = null;
}

// create DataTable
DataTable dtEmployees = new DataTable();

dtEmployees.Columns.Add("EmployeeID",typeof(int));
dtEmployees.Columns.Add("LastName",typeof(string)) ;
dtEmployees.Columns.Add("FirstName",typeof(string) );
dtEmployees.Columns.Add("Photo",typeof(byte[]));

DataRow dr = dtEmployees.NewRow();

dr["EmployeeID"] = 123;
dr["LastName"] = "Schwartzmann";
dr["FirstName"] = "Jeff";

if (PhotoData != null)
{
dr["Photo"] = PhotoData;
}
else
{
dr["Photo"] = DBNull.Value;
}

dtEmployees.Rows.Add(dr);

// run Crystal Report
String sCrystalReportFileName;

sCrystalReportFileName =
ConfigurationSettings.AppSettings["CrystalFilePath"] +
@"\CrystalReport1.rpt";

ReportDocument oRpt = new ReportDocument();
oRpt.Load(sCrystalReportFileName);
oRpt.SetDataSource(dtEmployees);

crViewer.DisplayGroupTree = false;
crViewer.ReportSource = oRpt;

}
Thanks in advance for your help!!!!

May 4 '06 #1
0 7361

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Stephan | last post by:
Hi, I'm using Visual Studio 2003 (C#) with the integrated Crystal Report software and have the following question: How can I assign a value (string) to an unbound (string) field in Crystal...
13
by: kristoff plasun | last post by:
I have a problem with a C++ DCOM application that prints Crystal Reports with data from Oracle. The SQL query is relatively complex but when the report is printed from the Crystal Reports...
1
by: Samuel | last post by:
I'm having a problem with this product. When I was using "Visual Studio.NET 1.0" to develop a project, we had no issues, but now after migrating to "Visual Studio.NET 2003" it does not use the...
7
by: p | last post by:
WE had a Crystal 8 WebApp using vs 2002 which we upgraded to VS2003. I also have Crystal 9 pro on my development machine. The web app runs fine on my dev machine but am having problems deploying....
5
by: Damir | last post by:
Please I need help and dont know where to post the question..... So I am making a small asp.net application and need to generate a crystal report with one image that changes depending of some data....
8
by: michele | last post by:
Hi, i have in my crystal report viewer .net a multiline field. When i preview the report, the text in the field is clipped on the right, so some words are invisible... i'm going mad; i've searched...
1
by: Peter Proost | last post by:
Hi group I know this isn't really a vb.net question but a lot of guys in here use crystal reports so maybe someone can help me or push me in the right direction (a link or so). I have got a report...
0
by: Chris | last post by:
I have the following situation in a VB.Net App I am working on: 1.)A report created in VS.Net 2003 using the CR.Net component of VS 2003. 2.)The datasource for the report is a Stored Proc in a...
0
by: Big George | last post by:
I'm developing with ASP.NET, VS.NET 2003. Using Crystal Report for VS.NET DataBase: Oracle 10g I store a BLOB field in a table. This field store images, like jpg files. The Stored Procedure...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.