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

czn5460 2008-07-17 05:21:25
我使用的是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();

}
}
...全文
31 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
czn5460 2008-07-17
  • 打赏
  • 举报
回复
到http://topic.csdn.net/u/20080717/11/d30159d0-1a35-4c5f-8950-eb7be4dab4cd.html提高答案50分~~问题一样

62,133

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧