-
Notifications
You must be signed in to change notification settings - Fork 0
/
ReportWebForm.aspx.cs
51 lines (38 loc) · 1.7 KB
/
ReportWebForm.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using System;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Web.UI;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
public partial class ReportWebForm : Page
{
protected void Page_Load(object sender, EventArgs e)
{
string cs = ConfigurationManager.ConnectionStrings["BarsslsConnection"].ConnectionString;
using (SqlConnection con = new SqlConnection(cs))
{
SqlDataAdapter da = new SqlDataAdapter(@" SELECT customers.customer_name, customers.sales_rep, customers.customer_type, customers.RW_rep_ID, customers.date_opened, customers.broker_ID, customers.cust_region " +
"FROM BARSSLS.dbo.customers customers ", con);
DataSet ds = new DataSet();
ReportDocument rd = new ReportDocument();
rd.Load(Server.MapPath("~/Reports/CrystalReps.rpt"));
rd.Refresh();
rd.SetDataSource(ds);// if you have any data source
CrystalReportViewer1.ReportSource = rd;
CrystalReportViewer1.DataBind();
ConnectionInfo myConnectionInfo = new ConnectionInfo();
myConnectionInfo.ServerName = "corp-bi-dev01";
myConnectionInfo.DatabaseName = "BARSSLS";
myConnectionInfo.UserID = "weboe";
myConnectionInfo.Password = "W3b0e";
TableLogOnInfos mytableloginfos = new TableLogOnInfos();
mytableloginfos = CrystalReportViewer1.LogOnInfo;
foreach (TableLogOnInfo myTableLogOnInfo in mytableloginfos)
{
myTableLogOnInfo.ConnectionInfo = myConnectionInfo;
}
//setDBLOGONforREPORT(myConnectionInfo);
}
}
}