如何将Crystal报表连接到C#Windows窗体, [英] How Do I Connect A Crystal Report To A C# Windows Form,

查看:106
本文介绍了如何将Crystal报表连接到C#Windows窗体,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在目标计算机上刷新报告时,目标计算机上出现错误

Error machine on target machine while refreshing report on target machine

Failed to open the connection.
Details: [Database Vendor Code:17]
Failed to Open Connection.
payments11 {D29B3531-EF7D-426E-B1DB-05CD2A63FA5F}.rpt
Details : [Database Vendor Code:17]





这是我的编码部分:





this is my coding part :

private void Preview_Click(object sender, EventArgs e)
        {
            SqlConnection cnn;
            string connectionString = null;
            string sql = null;

            connectionString = @"Data Source=.\SQLEXPRESS;Initial Catalog=trydb_1;Integrated Security=True";
            cnn = new SqlConnection(connectionString);
            cnn.Open();
            sql = "SELECT ID,pay_id,date,custname,description,chqno,duedate,accname,amount FROM payments";
            SqlDataAdapter dscmd = new SqlDataAdapter(sql, cnn);
 ReportDocument cryRpt = new ReportDocument();
            cryRpt.Load(@"D:\Completing\WindowsFormsApplication1\payments11.rpt");
            crystalReportViewer1.ReportSource = cryRpt;
            crystalReportViewer1.Refresh();
}





刷新用户/目标机器上的水晶报告时显示上述错误。但报告正在我的机器上运行。目标机器出错。



While refreshing the crystal report on users/target machine it shows the above error. But reports are running on my machine. Error on target machine.

推荐答案

参考文章:

生成报表 [ ^ ]


这篇关于如何将Crystal报表连接到C#Windows窗体,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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