基于来自数据库的Imagepath在Crystal Report中显示图像 [英] Display Images in Crystal Report From Folder based on Imagepath From Database

查看:63
本文介绍了基于来自数据库的Imagepath在Crystal Report中显示图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我想在数据库中基于Imagepath的文件夹中显示Crystal Report。

我使用的是Vb.net

谢谢你

Hi I want to dispaly image in Crystal Report From Folder Based on Imagepath from Database.
I am using Vb.net
Thank You

推荐答案



在报告中放置一个图像字段,然后更改图像的图形位置:

右键单击在图像中选择格式图形,选择图片选项卡,单击看起来像x2的条件公式按钮,并将公式的文本设置为将包含图像URL的公式或参数字段的名称。

保存公式,然后单击确定按钮。保存报告并进行测试。

小心图像区域的大小。如果这个大小不等于图像本身,它可以调整大小。



使用物理路径显示图像功能于晶体报告-http://stackoverflow.com/questions/3170387/display-image-in-crystal-report-using-physical-path [< a href =http://stackoverflow.com/questions/3170387/display-image-in-crystal-report-using-physical-pathtarget =_ blanktitle =New Window> ^ ]



最好的问候,

VG
Hi,
Put an image field in your report, then change the image’s Graphic Location:
right click the image, select Format Graphic, select Picture tab, click the conditional-formula button that look like a x2 and set the formula’s text to the name of the formula or parameter field that will contain the image’s URL.
Save the formula and click the OK button. Save the report and test it.
Be carefull with the size of the image field. If this size is not equal to the image itself it could get resized.

Googled from http://stackoverflow.com/questions/3170387/display-image-in-crystal-report-using-physical-path[^]

Best Regards,
VG


不要直接使用CR的物理路径。将您的图像存储在数据库的数据表或二进制字段中并显示它。



这是一个使用数据表的代码项目解决方案:



Crystal Reports中的图像



这很简单,C#还有点旧,但我觉得你有把戏。



[Agent_Spock]
删除了不需要的代码括号
Don't use physical paths with CR directly. Store your image in a datatable or in a binary field of your database and show that.

Here is a code project solution that uses datatables:

Image in Crystal Reports

It's simple, C# and a little old, but I think you get the trick.

[Agent_Spock]
Removed unwanted code brackets


str="select distinct code,designname from table1 left join table2 on table1.code=table2.code"
cmd = New SqlCommand(Str, sqlconn)
      adpt = New SqlDataAdapter(cmd)
      DataSetDesign = New DataSet
      DataSetDesign.Clear()
      adpt.Fill(DataSetDesign, "MYtable")


Create a new table "Pic"
Field : DSG_CODE,varchar(15)
        oImg,varbinary(MAX)


        Dim iCtr As Integer
            Dim cPict, cCat, cDesCode, SqlStr As String

            SqlStr = "Delete From pict"

            Dim cmdInsert As SqlCommand
            cmdInsert = New SqlCommand(SqlStr, sqlconn)
            cmdInsert.ExecuteNonQuery()

            For iCtr = 0 To DataSetDesign.Tables(0).Rows.Count - 1
                cCat = Trim(DataSetDesign.Tables(0).Rows(iCtr).Item("designname"))
                cDesCode = Trim(DataSetDesign.Tables(0).Rows(iCtr).Item("code"))

                'Path of Folder
                cPict = "y:\" + cCat + "\DM 3D " + cDesCode + ".JPG"

                    Dim oImg As Byte()
                    oImg = ReadImageFile(cPict)
                    SqlStr = "Insert Into pict(oImg, DSG_Code)values(@oImg , @DSG_Code)"
                    cmdInsert = New SqlCommand(SqlStr, sqlconn)
                    'cmdInsert(Sqlstr, sqlconn)
                    cmdInsert.Parameters.Add("@oImg", Data.SqlDbType.Binary).Value = oImg
                    cmdInsert.Parameters.Add("@DSG_CODE", Data.SqlDbType.VarChar).Value = cDesCode
                    cmdInsert.ExecuteNonQuery()
      Next


这篇关于基于来自数据库的Imagepath在Crystal Report中显示图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆