水晶报表中的数据访问 [英] Data access in crystal reports

查看:66
本文介绍了水晶报表中的数据访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个连接到Access数据库的VB.net应用程序.在应用程序中,我正在运行连接到同一数据库的Crystal Report.为了能够添加自定义命令,我必须直接通过CR数据库专家连接到数据库,因为使用Visual Studio提供的ADO连接不允许我创建自定义命令.
在Visual Studio 2010环境中,一切工作都很好,但是一旦部署到测试计算机上,该报告将不再起作用.通过ConnectionInfo设置数据库连接不起作用(CR一直在询问用户名/通行证,并且没有通向数据库的通行证.
谁能说出是否有可能向ADO.NET数据集添加自定义命令?如果不是,将CR连接到Acces数据库的正确语法是什么(通过提供Access文件名)?

更新: 在DataSourceConnections上设置连接会导致CR提示输入Access文件的用户/密码. mdb文件(Access 2010)不受密码保护(文件和工作组级别).

Cheers

Hi,

I have a VB.net application that is connected to an Access database. In the application I am running a Crystal Report that is connected to the same database. In order to be able to add a custom command, I had to connect to the database directly through the CR database expert since using the ADO connection provided by Visual Studio does not allow me to create custom commands.
Everything works just fine inside the Visual Studio 2010 environment, but once deployed on a test machine the report does not work anymore. Setting up the database connection through a ConnectionInfo does not work (CR keeps on asking for a user/pass and there is no pass to the database.
Can anyone tell if it is at all possible to add a custom command to an ADO.NET dataset? If not, what is the proper syntax to connect CR to an Acces database (by providing the Access file name)?

Update: Setting the connection on the DataSourceConnections causes CR to prompt for the user/pass of the Access file. The mdb file (Access 2010)is not password protected (file and workgroup level).

Cheers

推荐答案

您需要查看ReportDocument对象,特别是DataSourceConnections属性.我猜想在部署访问数据库时,开发数据库所处的目录与开发计算机所处的目录不同,而您必须为报告设置该目录.应该看起来像这样:

You need to look at the ReportDocument object, specifically the DataSourceConnections property. I''m guessing that when you deploy your access database is located in a different directory than your development machine and you have to set that for the report. Should look something like this:

ReportDocument1.DataSourceConnections.Item(0).SetConnection(strLocationOfDatabase, "", False)


或具有登录凭据:


or with login credentials:

ReportDocument1.DataSourceConnections.Item(0).SetConnection(strLocationOfDatabase, "", "UserName", "Password")



本文 [ google [



This article[^] looks like it can explain it pretty good. Or you could google[^].

If this is not the case and you deploy differently, please edit your question to specify. Hope this helps.


这篇关于水晶报表中的数据访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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