关于在C#的客户端上运行Crystal Report [英] About running crystal report on client side in c#

查看:75
本文介绍了关于在C#的客户端上运行Crystal Report的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我已将数据库的.mdf和.ldf文件复制到应用程序的bin/debug文件夹中,并按如下所示使用连接字符串

数据源=.\ SQLEXPRESS; AttachDbFilename = | DataDirectory | \ hm.mdf;集成安全性= True;用户实例= True
其中hm =数据库名称
应用程序运行正常,但现在在运行时以及创建设置文件后出现新错误.我在设置项目以及bin/release文件夹中复制了.mdf文件和.ldf文件,然后整个应用程序运行正常,但现在我得到了水晶报表要求用户名和密码时发生错误.

请同样建议我.

在此先感谢.

Hi All,

I have copied .mdf and .ldf files of database in bin/debug folder of my application and used the connection string as follows

Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\hm.mdf;Integrated Security=True;User Instance=True
where hm=database name
application runs fine but now i am getting new error while running and after creating set up file.I copied .mdf file and .ldf file in set up project and also in bin/release folder and then total application runs fine but now i am getting error in crystal report asking for user name and passwords.

Please suggest me for the same.

Thanks in Advance.

推荐答案

我们也遇到了相同的错误,然后我们将创建一个数据集并将记录传递给报表(Crystal Report查看器所在的位置).它的调用推送报告.



这是代码
We are also getting the same error, then we will create a data set and pass the record to report (Where crystal report viewer is) . Its call Push report.



Here is the code
<br />
ReportDocument cryRpt = new ReportDocument();<br />
                TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();<br />
                TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();<br />
                ConnectionInfo crConnectionInfo = new ConnectionInfo();<br />
<pre lang="midl">cryRpt.Load(System.Windows.Forms.Application.StartupPath + "\\PickListRpt.rpt");</pre><br />
<br />
<pre lang="midl">crConnectionInfo.ServerName = lstrServerName;<br />
              crConnectionInfo.DatabaseName = lstrDatabaseName;<br />
              crConnectionInfo.UserID = lstrUserName;<br />
              crConnectionInfo.Password = lstPass;</pre><br />
<br />
string lstrQry =" Your Query ";<br />
<br />
                SqlConnection con = new SqlConnection(clsUserInterface.ConnectionString);<br />
                SqlDataAdapter dr = new SqlDataAdapter(lstrQry, con);<br />
<br />
                DataSet1 ds2 = new DataSet1();<br />
<br />
                dr.Fill(ds2.Tables["dtReport"]);<br />
                cryRpt.SetDataSource(ds2);<br />
<pre lang="midl">crystalReportViewer3.ReportSource = cryRpt;<br />
                crystalReportViewer3.Refresh();</pre><br />
<br />


这篇关于关于在C#的客户端上运行Crystal Report的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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