求泰哥******文件.rpt 内出错 无法连接:错误的登录参数。******

Louis-Lv 2011-09-21 01:25:12
水晶报表打印的时候 等了很久 才弹出这个错误的!!!!
...全文
432 14 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
PM老猫 2013-04-10
  • 打赏
  • 举报
回复
我也遇到了类似的错误 ,工具栏上的 翻页 打印 查看等都提示这个。 后来发现原因是回传,由于我的是在网站项目中打印 所以用的是 asp.net 页面,每次点工具栏按钮的时候 页面会回传一次,回传的时候报表绑定的数据源会丢失,把 绑定报表的方法放到 postback 中就行了。
Louis-Lv 2011-09-23
  • 打赏
  • 举报
回复
[Quote=引用 12 楼 ajaxtop 的回复:]
楼主,你有空了,先做一个简单一点的,你上面那个传参做的实在没看明白

你先做一个简单的,哪怕不传值,只要显示出来之后咱在基础上在做复杂的

简单应用

先做一个简单的验证,报表运行,开发机配置都没问题后,在做上面的


C# code

private void PrintReport(string printerName)
{
PageMargins margin……
[/Quote]
恩。。 先试试!!!!
Louis-Lv 2011-09-22
  • 打赏
  • 举报
回复
rd.PrintToPrinter(1,false,0,0);

错误提示在这一句!!!!
dianxiaoyu 2011-09-22
  • 打赏
  • 举报
回复
帮顶 不懂 学习……Up
Louis-Lv 2011-09-22
  • 打赏
  • 举报
回复

//打印
protected void Button4_Click(object sender, EventArgs e)
{
string sqlstring=null;
Session["language"] = this.RBL_language.SelectedValue;
DataSet ds = new DataSet();
QuotationDB qdb = new QuotationDB();
if (this.Panel_quotNO.Visible)
{
if (this.RBL_language.SelectedValue == "C")
{
sqlstring = "select b.*,a.* from V_reportmaster b,V_reportFee a where b.QuotationCode = a.QuotationCode";
}
else if (this.RBL_language.SelectedValue == "E")
{
sqlstring = "select b.*,a.* from V_reportmasterE b,V_reportFee a where b.QuotationCode = a.QuotationCode";
}
else if (this.RBL_language.SelectedValue == "J")
{
sqlstring = "select b.*,a.* from V_reportmasterJ b,V_reportFee a where b.QuotationCode = a.QuotationCode";
}
// string sqlstring = "SELECT [QuotationCode] FROM [QuotationMaster]";
sqlstring += " and a.QuotationCode like '" + this.TB_QuotNO.Text + "'";

// this.SqlDataSource1.SelectCommand = sqlstring;
}
if (this.Panel_term.Visible)
{
if (this.RBL_language.SelectedValue == "C")
{
sqlstring="select *,V_reportFee.* from V_reportmaster a,V_reportFee where V_reportmaster.QuotationCode = V_reportFee.QuotationCode";
}else if(this.RBL_language.SelectedValue == "E")
{
sqlstring = "select *,V_reportFee.* from V_reportmasterE a,V_reportFee where V_reportmaster.QuotationCode = V_reportFee.QuotationCode";
}
else if (this.RBL_language.SelectedValue== "J")
{
sqlstring = "select *,V_reportFee.* from V_reportmasterJ a,V_reportFee where V_reportmaster.QuotationCode = V_reportFee.QuotationCode";
}

//客户条件
if (this.TBCustomerCode.Text != "")
{
sqlstring += " and a.CustomerID='" + this.TBCustomerCode.Text + "' ";
}
//发货人条件
if (this.TB_shipperCode.Text != "")
{
sqlstring += " and a.ShippersID='" + this.TB_shipperCode.Text + "' ";
}
//收货人条件
if (this.TB_consigneeCode.Text != "")
{
sqlstring += " and a.ConsigneeID='" + this.TB_consigneeCode.Text + "' ";
}

//目的港
if (this.TBPortCode.Text != "")
{
sqlstring += " and a.DestPort='" + this.TBPortCode.Text + "' ";
}
//担当条件
if (this.TBOperator.Text != "")
{
sqlstring += " and a.Operator='" + this.TBOperator.Text + "' ";
}
//有效期条件
if (this.TBvalidityDate.Text != "")
{
sqlstring += " and a.ValidityDate='" + this.TBvalidityDate.Text + "' ";
}
this.SqlDataSource1.SelectCommand = sqlstring;
}
ds = qdb.getQuotationC(sqlstring);
DataSourceSelectArguments selectArg = new DataSourceSelectArguments();
CrystalDecisions.Shared.ParameterDiscreteValue pcode = new CrystalDecisions.Shared.ParameterDiscreteValue();

CrystalDecisions.CrystalReports.Engine.ReportDocument rd = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
if (Session["language"] != null && Session["language"] != "")
{
rd.Load(Server.MapPath("report\\Quotation" + Session["language"].ToString() + ".rpt"));
}
else
{
rd.Load(Server.MapPath("report\\QuotationC.rpt"));
}
rd.PrintOptions.PrinterName = DDL_printer.SelectedValue;
rd.SetDataSource(ds.Tables[0]);
try
{
rd.PrintToPrinter(1,false,0,0);
// rd.PrintToPrinter(1, false, int.Parse(this.TB_Pfrom.Text), int.Parse(this.TB_Pto.Text));//20061215
rd.Dispose();

}
catch
{
Response.Write("<script>window.alert('打印机状态出错,请重新选择!')</script>");
}


}


这个打印的代码,,大神 帮我看看
Louis-Lv 2011-09-22
  • 打赏
  • 举报
回复
文件 C:\DOCUME~1\lvzm\LOCALS~1\Temp\QuotationC {90990E9C-65BA-4B93-8438-24353451D33A}.rpt 内出错:
无法连接:错误的登录参数。、



吧验证去掉了 还是这个错误。。。。
Louis-Lv 2011-09-22
  • 打赏
  • 举报
回复
先试试在说,。,,, 谢谢啦!~!!
ajaxtop 2011-09-22
  • 打赏
  • 举报
回复
楼主,你有空了,先做一个简单一点的,你上面那个传参做的实在没看明白

你先做一个简单的,哪怕不传值,只要显示出来之后咱在基础上在做复杂的

简单应用

先做一个简单的验证,报表运行,开发机配置都没问题后,在做上面的

private void PrintReport(string printerName)
{
PageMargins margins;

// 获取 PageMargins 结构并设置
// 报表的边距。
margins = Report.PrintOptions.PageMargins;
margins.bottomMargin = 350;
margins.leftMargin = 350;
margins.rightMargin = 350;
margins.topMargin = 350;
// 应用页边距。
Report.PrintOptions.ApplyPageMargins(margins);

// 选择打印机。
Report.PrintOptions.PrinterName = printerName;

// 打印报表。将 startPageN 和 endPageN
// 参数设置为 0 表示打印所有页。
Report.PrintToPrinter(1, false,0,0);
}

你那个方法是没有错误的,所以先写个简单的看下吧
阿泰 2011-09-21
  • 打赏
  • 举报
回复
如Ajaxtop所说,“水晶报表右键,把菜单中的验证,登录啊,之类的有没有全去掉”这个检查一下
不够后面的3行应该不会导致这个问题。
水晶报表在导出、打印、翻页时默认是都需要重新连接数据源的
参照
http://topic.csdn.net/u/20090713/18/6e14bf28-1979-4ade-9c60-aaf09284553d.html试试。

ajaxtop 2011-09-21
  • 打赏
  • 举报
回复
水晶报表右键,把菜单中的验证,登录啊,之类的有没有全去掉
水晶报表注册检查一下
水晶报表要配置一个文件夹
检查水晶报表方法打断点,看是否程序出错导致
Louis-Lv 2011-09-21
  • 打赏
  • 举报
回复
没人么!!!
Louis-Lv 2011-09-21
  • 打赏
  • 举报
回复
泰哥
Louis-Lv 2011-09-21
  • 打赏
  • 举报
回复
自己顶一下!!!

4,819

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 图表区
社区管理员
  • 图表区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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