Last post Oct 13, 2011 11:14 AM by d.developer
Oct 10, 2011 10:35 AM|DoneGone|LINK
NewBe here to Crystal Reports. Another programmer created the reports back in 2005, I have taken over the project and converted the project from VS2003 to VS2010. There are 14 roports each with the same layout. Section 1 displays info from SQL Server Stored
Procedure. Remaining sections from 4 to 14 sections) display scanned images that are all set when the report was created. In the last section I need to display an image but I don't know which image until the report is running. The path and name of the file
is returned in the SQL stored procedure. The file may be a jpeg, bmp or pdf. Using VS2010 .Net 3.5, SQL Server 2005 and ASP,Net.
Oct 10, 2011 11:13 AM|Anindita.Basak|LINK
In order to return image from SQL Stored Procedure as data source in crystal reports, we need to modify the Stored procedure so that it returns an additional column of type SQL image.The purpose of such SQL Image field will be to hold the image generated
for each field in the result set.
So let's modify that hypothetical SP so it returns a result set with a SQL Image type. You must add the following SP into your local Database.
ALTER PROCEDURE dbo.GetCustomers AS
Local variable to initialize field
DECLARE @Image AS BINARY
SET @Image = NULL
Create a SQL Temp Table with the same structure as Customers Table
and adding an additional field of type Image for barcoding
CREATE TABLE #CustomerTempTable
Populate the temp table
INSERT INTO #CustomerTempTable
SELECT CustomerID, CompanyName, City, Country, @Image
Return result set with barcode column
SELECT * FROM #CustomerTempTable
Delete temp table
DROP TABLE #CustomerTempTable
Oct 10, 2011 12:02 PM|DoneGone|LINK
My SQL table already had the image in binary form in the table. I verifed that I can read the table and display the image using straight VB code. My stored procedure returns the image. I know that having never used Crystal Reports before is my biggest problem.
In SQL the field id defined as 'Image'. When I go into Crystal Reports and drag it to the form then go to Format Editor the 'Can Grow' check box is grayed out. It looks like it thinks the field is 'text' in the Sample box at the bottom it shows '-5,555,555'
instead of 'BLOB Field'. Should I define the field as binary instead of Image in SQL Server (SQL Server 2005 is being used).
Oct 13, 2011 11:14 AM|d.developer|LINK
i think the better approach is too save the image in the folder and place the image on report and assign the absolute path of the image in crystal report will resolve the problem.