Hi Guys,
I'm trying to make report using query View in sql server to show the report result in ASP.NET, but the View not showing report.
After code in .aspx running just showing blank result.
The result is just join 2 tables that is tbl_anggota and tbl_simpanan.
This is the query of view in SQL SERVER
USE [db_koperasi]
GO
/****** Object: View [dbo].[View_Report_Anggota] Script Date: 28/06/2021 21.03.55 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[View_Report_Anggota]
AS
SELECT dbo.tbl_anggota.id_anggota, dbo.tbl_anggota.nama_anggota, dbo.tbl_anggota.alamat, dbo.tbl_anggota.no_telpon, dbo.tbl_anggota.saldo, dbo.tbl_simpanan.id_simpanan, dbo.tbl_simpanan.tanggal_simpanan,
dbo.tbl_simpanan.jenis_simpanan, dbo.tbl_simpanan.jumlah_simpanan
FROM
dbo.tbl_anggota
INNER JOIN
dbo.tbl_simpanan
ON dbo.tbl_anggota.id_anggota = dbo.tbl_simpanan.id_anggota
GO
This is the code bihind
protected void BtnJoinReportAnggota_Click(object sender, EventArgs e)
{
ShowData();
}
private void ShowData()
{
using (SqlConnection con = new SqlConnection(koneksi))
{
try
{
con.Open();
SqlDataAdapter adap = new SqlDataAdapter("Select * From View_Report_Anggota Where id_anggota = '" + txtIdAnggota.Text + "'", con);
DataSet ds = new DataSet();
adap.Fill(ds, "DataTableJoinReportAnggota");
ReportDataSource rds = new ReportDataSource("DataSetJoinReportAnggota", ds.Tables[0]);
ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/RdlcReport/ReportAnggotaByID.rdlc");
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(rds);
ReportViewer1.LocalReport.Refresh();
con.Close();
}
catch (Exception ex)
{
throw ex;
}
}
}