(50分求解)水晶报表打印纸张大小控制和打印报错问题??????急!!!

czn5460 czn5460 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我使用的是VS2005自带的水晶报表,我在网站上放3个TEXT.BOX用来输入查询条件和一个查询按钮,拉入CrystalReportSource1和CrystalReportViewer1,格式设好的报表名CrystalReport。目的是通过点查询按钮Button1把资料查出来在已经定好格式的报表里显示,然后直接打印,我怎么把打印纸张大小固定呢?比如1/2letter 在VS2005里调试时可以在报表打印机里设置,预览正常,但在客户端连时报表大小就变了!还有就是查出资料后点打印按钮点打印时弹出“出现通信错误。将停止打印”。这该如何解决?C#代码:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using CrystalDecisions.Shared;
using CrystalDecisions.CrystalReports.Engine;
using System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page
{

protected void Button1_Click(object sender, EventArgs e)
{
if (TextBox1.Text == "")
{
TextBox1.Text = "0";
}
if (TextBox2.Text == "")
{
TextBox2.Text = "0";
}
if (TextBox3.Text == "")
{
TextBox3.Text = "0";
}
string sql = "SELECT Corpid, corpname, aliasname,fstcreate FROM corpbsl where corpid between ' " + TextBox1.Text + "' and '" + TextBox2.Text + "'or corpid='" + TextBox3.Text + "'";

string DBConfig_sql = @"Data Source=DESI;Initial Catalog=crmtmp;User ID=sa;Password=zy";

DataSet ds = new DataSet();

SqlConnection sqlCon = new SqlConnection(DBConfig_sql);

SqlCommand sqlCmd = new SqlCommand(sql, sqlCon);

SqlDataAdapter sqlAd = new SqlDataAdapter();

sqlAd.SelectCommand = sqlCmd;

sqlAd.Fill(ds, "sql");

CrystalReportSource1.ReportDocument.Load(Server.MapPath("CrystalReport.rpt"));

CrystalReportSource1.ReportDocument.SetDataSource(ds.Tables["sql"]);

CrystalReportSource1.DataBind();

CrystalReportViewer1.ReportSource = CrystalReportSource1;

CrystalReportViewer1.DataBind();

}
}
...全文

相关推荐

评论 3
收藏 已收藏
分享
返回顶部
czn5460
C# 111,129 成员 642,540 内容