alvinng
asked on
display picture by string field
My company uses VB6, Crystal Report8.5, MS SQL Server as development tools. I can't insert the photo files into MS SQL server because of company policy. Now, I would like to display the photo in Crystal Report by these string field in a table.
Table structure like the following sample.
create table PhotoTable
(
KeyField int,
PhotoField varchar(50) null
)
Here is its data.
KeyField PhotoField
1 "c:\photo_dir\1.jpg"
2 "c:\photo_dir\2.jpg"
3 "c:\photo_dir\3.jpg"
4 "c:\photo_dir\4.jpg"
5 "c:\photo_dir\5.jpg"
There is a directory to place all photos files.
SQL statement is
"Select KeyField, PhotoField from PhotoTable"
I want to display some selected photos in detail section.
I find that there is no way to convert string field into a photo.
I can't use OLE because it set the file name during design time.
I can't use blob field because it is company policy.
Is there anyone help?
Table structure like the following sample.
create table PhotoTable
(
KeyField int,
PhotoField varchar(50) null
)
Here is its data.
KeyField PhotoField
1 "c:\photo_dir\1.jpg"
2 "c:\photo_dir\2.jpg"
3 "c:\photo_dir\3.jpg"
4 "c:\photo_dir\4.jpg"
5 "c:\photo_dir\5.jpg"
There is a directory to place all photos files.
SQL statement is
"Select KeyField, PhotoField from PhotoTable"
I want to display some selected photos in detail section.
I find that there is no way to convert string field into a photo.
I can't use OLE because it set the file name during design time.
I can't use blob field because it is company policy.
Is there anyone help?
ASKER
Dear DRRYAN3!
Of course I can replace picture by vb code. However, I do not know how many pictures get by SQL query and prepare enough space to display the pictures as I will change WHERE clause by vb code. For example.
Example 1.
Select KeyField, PhotoField from PhotoTable
where KeyField > 0
Example 2.
Select KeyField, PhotoField from PhotoTable
where KeyField in (1, 2, 5)
Example 3.
Select KeyField, PhotoField from PhotoTable
where KeyField = 4
Is there any function to change "c:\photo_dir\1.jpg" to a picture rather than a string??
Thanks
Alvin
Of course I can replace picture by vb code. However, I do not know how many pictures get by SQL query and prepare enough space to display the pictures as I will change WHERE clause by vb code. For example.
Example 1.
Select KeyField, PhotoField from PhotoTable
where KeyField > 0
Example 2.
Select KeyField, PhotoField from PhotoTable
where KeyField in (1, 2, 5)
Example 3.
Select KeyField, PhotoField from PhotoTable
where KeyField = 4
Is there any function to change "c:\photo_dir\1.jpg" to a picture rather than a string??
Thanks
Alvin
This question has been open now for months without a resolution and/or an accepted answer and will be submitted to the Cleanup section for closure.
My recommendation: PAQ & refund
DRRYAN3
My recommendation: PAQ & refund
DRRYAN3
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Private Sub Command1_Click()
Dim crApp As New CRAXDRT.Application
Dim crRep As CRAXDRT.Report
' load a standalone report created in the designer
Set crRep = crApp.OpenReport("c:\crw_s
CRViewer1.ReportSource = crRep
crRep.VerifyOnEveryPrint = True
' Add a picture to Page Header
crRep.Sections.Item(2).Add
' Add a picture to Detail
crRep.Sections.Item(3).Add
' print preview
CRViewer1.ViewReport
End Sub
You would have to replace "c:\logo.jpg" with the appropriate file name. Your section numbers might be different too - depends on how you put your report together.
DRRYAN3