如何将Crystal Report数据源设置为MS Access DB的程序启动路径 [英] How to set Crystal report data source as program startup path for ms access db

查看:79
本文介绍了如何将Crystal Report数据源设置为MS Access DB的程序启动路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我需要知道如何将Crystal Report数据源设置为应用程序启动路径...
问题:部署后,它需要我在报表设计中使用的数据库.


我试过了,

Hi,
i need to know how to set crystal Report data source as application start up path...
Problem: After deployment it requires the db which i used in the report design.


i tried,

ReportDocument rd=new ReportDocument();
rd.SetDatabaseLogon("username","password","Application.StartupPath","MyDB");



但它不起作用...

谁能给我解决方案,请....



but it is not working...

Can any one give me solution Please....

推荐答案

您需要在运行时设置数据库源.
you need to set the database source at run time.
Dim cRep As New CrystalReport1
Dim crConInfo As New ConnectionInfo
Dim crLogInfo As New TableLogOnInfo
With crConInfo
    .ServerName = "ServerName"
    .Database = "Database"
    .UserID = "UID"
    .Password = "PWD"
End With

crLogInfo.ConnectionInfo = crConInfo
cRep.Database.Tables(0).ApplyLogOnInfo(crLogInfo)



不要忘记使用ApplyLogoninfo,它将更改报表中使用的对象的登录详细信息,然后只有报表将与新数据库一起使用.

HTH.



Don''t forget to use ApplyLogoninfo it will change the login details of the objects used in the report and then only report will work with the new database.

HTH.


确保将连接信息应用于已加载的Crystal报表对象.
Make sure you are applying the connection info to the crystal report object that you have loaded.


这篇关于如何将Crystal Report数据源设置为MS Access DB的程序启动路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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