您的位置:首页 > 编程语言 > ASP

asp.net采用DCOM连接打印报表Fastreport

2011-07-27 11:55 369 查看
脚本:
<body onkeydown="next();">
<form id="form1" runat="server">
<input id="serverinfo" type="hidden" runat="server" value="" />
<OBJECT ID="uprint" CLASSID="CLSID:7D79186A-EA0D-49F9-B104-E7AE9DA1B7FB" width="0" height="0" CODEBASE="../Report/uprintct.CAB#version=1,2,0,1"></OBJECT>

<div id="div1" runat="server">
..................
<input type="button" onclick="print('','CashTranDtl.fr3');" class="button_bak" value="打 印" style="margin-left:100px " />
........

传送打印参数过程:
<script language="javascript" type="text/javascript">
function $(obj)
{
return document.getElementById(obj);
}
function print(billctl,reportname)
{
var servername;
var userid;
var password;
var bill_no;
var dbname;

servername= $('serverinfo').value.split(';')[0];
userid= $('serverinfo').value.split(';')[1];
password= $('serverinfo').value.split(';')[2];
dbname =$('serverinfo').value.split(';')[3];
if (billctl!='')
{
bill_no = $(billctl).value;
}
else
{
bill_no =$('serverinfo').value.split(';')[4];
}
$('uprint').openrpt(servername,userid,password,dbname,reportname,bill_no);
}
</script>

启动连接数据库参数:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
serverinfo.Value = System.Configuration.ConfigurationManager.AppSettings["servername"] + ";" + System.Configuration.ConfigurationManager.AppSettings["userid"] + ";"
+ System.Configuration.ConfigurationManager.AppSettings["password"] + ";" + System.Configuration.ConfigurationManager.AppSettings["dbname"] + ";" + Session["userno"].ToString() + "-" + Environment.MachineName.ToString();
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: