-
Notifications
You must be signed in to change notification settings - Fork 0
/
Default.aspx.cs
46 lines (38 loc) · 1.67 KB
/
Default.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
dsViewVendasTableAdapters.VendasTableAdapter tableAdapter = new dsViewVendasTableAdapters.VendasTableAdapter();
dsViewVendas.VendasDataTable dataTable = new dsViewVendas.VendasDataTable();
dataTable.Merge(tableAdapter.MeuSelect());
DataSet ds = new DataSet();
DataTable t = dataTable;
Microsoft.Reporting.WebForms.ReportDataSource item = new Microsoft.Reporting.WebForms.ReportDataSource();
item.Name = "dsViewVendas_VendasTableAdapter";
item.Value = dataTable;
rv.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;
rv.LocalReport.ReportPath = Server.MapPath("~/Report2.rdlc");
//rv.LocalReport.DataSources.Add(item);
rv.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("dsViewVendas_VendasDataTable", (DataTable)dataTable));
rv.DataBind();
GridView1.DataSource = dataTable;
GridView1.DataBind();
}
private DataSet GetVendas()
{
DataSet ds = new DataSet();
SqlConnection conn = new SqlConnection("Data Source=POVEDA-PC\\SQLEXPRESS;Initial Catalog=TestingReport;Integrated Security=True");
SqlCommand command = new SqlCommand("Select * From Vendas", conn);
SqlDataAdapter daVendas = new SqlDataAdapter(command);
daVendas.Fill(ds, "Vendas");
return ds;
}
}