我想在Crystal Report查看器中设置动态路径吗? [英] I want to set a dynamic path in crystal report viewer?

查看:71
本文介绍了我想在Crystal Report查看器中设置动态路径吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友

我将VB.net 2008用作前端,将Access 2010用作数据库.在VB.net中,我已使用CRV来查看水晶报表.

现在的问题是,当我将文件夹移动到任何其他路径时,Crystal报表中会出现一些登录ID和密码,这显示了错误的路径,因此现在存在用于查看Crystal报表的任何相对或动态路径. >
CRV是否还有其他属性可以提供相对路径,因此,如果将文件夹从一个位置移动到另一个位置,那么我们还可以看到水晶报表?还是还有其他方法可以为水晶报表设置相对路径?

希望大家都明白我想说的意思.谁能用简单的方式说

抱歉,我是新来的人.

请朋友们在3月21日之前为我提供帮助,因为这一天我要发表演讲.

感谢您的全部,:)

Hello Friend

I am using VB.net 2008 as front end and Access 2010 as database. In VB.net I have used CRV for viewing crystal report.

Now the problem is that when I''m moving the folder to any other path then some login id and password occurs in crystal report, which shows the wrong path so now is there any relative or dynamic path for viewing crystal report.

Is there any other properties of CRV in which we can give the relative path so that if we move folder from one place to another then also we can see the crystal report? Or is there any other way to set relative path for crystal report?

Hope so you all got the meaning what I want to say. Can any one say in simple way

Sorry but I am new for using this.

Please friends just help me before 21st march because I have presentation on this day.

Thanks to all of u, :)

推荐答案

这是我过去使用过的,也许它可以为您指明正确的方向:

This is what I''ve used in the past, maybe it can point you in the right direction:

Dim strSchemaPath As String = My.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData & System.IO.Path.DirectorySeparatorChar & "MySchemaDatabase.mdb"
Dim cdReportDocument As New CrystalDecisions.CrystalReports.Engine.ReportDocumentcdReportDocument.DataSourceConnections.Item(0).SetConnection(strSchemaPath, "", False)cdReportDocument.SetDataSource(dsMyDataSet)


您是指动态路径而不是硬代码路径吗?如果是,则将报告文件存储在Web服务器或应用程序目录(也为远程计算机路径)中.请通过以下方式致电.

如果是网络应用程序
Do you mean dynamic path instead of hard-code path? If yes then store the reports files in web server or application directory(also remote machine path) & call by the below ways.

If it''s a web application
report.Load(Server.MapPath("Report1.rpt"));//C#


report.Load(Server.MapPath("Report1.rpt"))'VB.NET


否则,如果它是Windows应用程序


else if it''s a windows application

report.Load(Application.StartupPath + "Report1.rpt");//C#


report.Load(Application.StartupPath & "Report1.rpt")'VB.NET


顺便说一句,对于Windows应用程序,您可以使用其他路径,例如CommonAppDataPath, ExecutablePath, LocalUserAppDataPath, UserAppDataPath.有关更多信息,请 Clickety [


BTW for windows applications you can use other paths like CommonAppDataPath, ExecutablePath, LocalUserAppDataPath, UserAppDataPath. For more info Clickety[^]


好亨利,
看到我在Crystal Report Viewer中使用.rpt文件,现在的问题是,我已经在.rpt文件中给出了数据库文件的路径,通过它我无法在运行时看到该文件,但是每当我将项目文件夹移动到其他驱动器,则显示对话框数据库登录".因此,即使我更改文件夹的路径,我也只想查看我的报告.还有另一件事,我将那个.rpt文件保存在同一文件夹中.

帮我解决这个问题.

谢谢兄弟.
Ok Henry,
see i am using .rpt file with crystal report viewer, now the thing is that i have already given the path of Database file in .rpt file and by which i m able to see that at run time but whenever i am moving my projects folder to some other drive then it shows the dialog box "Database Login". So i just want to see my reports even if i change the path of my folder. and one more thing i hv kept that .rpt file in the same folder.

just help me out from this.

Thanks bro.


这篇关于我想在Crystal Report查看器中设置动态路径吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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