Một vấn đề tôi thường gặp phải khi dùng report truyền dữ liệu bằng pramater thì cửa sô login server của sql hiện lên rất khó chịu
giải quyết vấn đề đó như sau :
using System;
using System.Windows.Forms;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
ReportDocument cryRpt = new ReportDocument();
TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();
ConnectionInfo crConnectionInfo = new ConnectionInfo();
Tables CrTables ;
cryRpt.Load("PUT CRYSTAL REPORT PATH HERE\CrystalReport1.rpt");
crConnectionInfo.ServerName = "YOUR SERVER NAME";
crConnectionInfo.DatabaseName = "YOUR DATABASE NAME";
crConnectionInfo.UserID = "YOUR DATABASE USERNAME";
crConnectionInfo.Password = "YOUR DATABASE PASSWORD";
CrTables = cryRpt.Database.Tables ;
foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
{
crtableLogoninfo = CrTable.LogOnInfo;
crtableLogoninfo.ConnectionInfo = crConnectionInfo;
CrTable.ApplyLogOnInfo(crtableLogoninfo);
}
crystalReportViewer1.ReportSource = cryRpt;
crystalReportViewer1.Refresh();
}
}
}
Các bài đã đăng
-
▼
2013
(
27
)
-
▼
March
(
15
)
- Mã hóa chuỗi bằng c#
- XML với C#
- Gửi mail bằng C#
- Các thao thác cơ bản trực tiếp trên gridview của a...
- SQL-Assitant Một tool không thể thiếu khi code sq...
- Datetimepicker dùng jquery
- Truyền biến bằng delegate
- Repot login 4
- Report Chuyển sang excel 3
- Report 2
- Report với VS2010 1
- combobox change
- Kiểm tra tính đúng đắn dữ liệu trong datagridview
- Tạo các control trong datagridview khi click chuột...
- Combox ajax trong winfrom =)))
-
▼
March
(
15
)
Recent Post
Thursday, March 28, 2013
Repot login 4
by Unknown |  at 1:52 AM
Popular Posts
Quang Cao
Blog Archive
-
▼
2013
-
▼
March
- Mã hóa chuỗi bằng c#
- XML với C#
- Gửi mail bằng C#
- Các thao thác cơ bản trực tiếp trên gridview của a...
- SQL-Assitant Một tool không thể thiếu khi code sq...
- Datetimepicker dùng jquery
- Truyền biến bằng delegate
- Repot login 4
- Report Chuyển sang excel 3
- Report 2
- Report với VS2010 1
- combobox change
- Kiểm tra tính đúng đắn dữ liệu trong datagridview
- Tạo các control trong datagridview khi click chuột...
- Combox ajax trong winfrom =)))
-
▼
March
Proudly Powered by Blogger.
0 comments: