crystal report 2011 如何通过函数打印
1个回答
2014-11-17
展开全部
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
namespace CS_Base
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void ConfigureCrystalReports()
{
ConnectionInfo connectionInfo = new ConnectionInfo();
connectionInfo.ServerName = "dholmes_50701";
connectionInfo.DatabaseName = "Northwind";
connectionInfo.UserID = "limitedPermissionAccount";
connectionInfo.Password = "1234";
string reportPath = Application.StartupPath + "\\" + "NorthwindCustomers.rpt";
crystalReportViewer.ReportSource = reportPath;
SetDBLogonForReport(connectionInfo);
}
private void Form1_Load(object sender, EventArgs e)
{
ConfigureCrystalReports();
}
private void crystalReportViewer_Load(object sender, EventArgs e)
{
}
private void SetDBLogonForReport(ConnectionInfo connectionInfo)
{
TableLogOnInfos tableLogOnInfos = crystalReportViewer.LogOnInfo;
foreach (TableLogOnInfo tableLogOnInfo in tableLogOnInfos)
{
tableLogOnInfo.ConnectionInfo = connectionInfo;
}
}
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询