PDA

View Full Version : [ASK]Refresh CrystalReport di VB.NET


PHPmaster
20th November 2011, 11:55 PM
gini gan

ane pake VB.NET 2005 sqlsrvr 2000 n crystalreport8.5



ane mw tanya cara supaya kalo kita update isi dr database misal "kita hapus atau kita tambah k dalem datagrid/database"

nah pas kita mw liat laporannya tuh udah ke refresh otomatis gitu gan

tanpa harus refresh n save dr crystalreportnya





ini percobaan yang ane lakukan


Spoiler for code:






Imports CrystalDecisions.CrystalReports.Engine

Imports CrystalDecisions.Shared



Public Class Siswa



Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Laporan.Show()

'Laporan.CRV.ReportSource = Nothing

'Laporan.CRV.RefreshReport()

'Laporan.CRV.ReportSource = "Laporan.rpt"



Dim cryRpt As New ReportDocument

Dim crtableLogoninfos As New TableLogOnInfos

Dim crtableLogoninfo As New TableLogOnInfo

Dim crConnectionInfo As New ConnectionInfo

Dim CrTables As Tables

Dim CrTable As Table

cryRpt.Load("laporan.rpt")

With crConnectionInfo

.ServerName = "namapc"

.DatabaseName = "namadatabase"

.UserID = "sa"

.Password = ""

End With

CrTables = cryRpt.Database.Tables

For Each CrTable In CrTables

crtableLogoninfo = CrTable.LogOnInfo

crtableLogoninfo.ConnectionInfo = crConnectionInfo

CrTable.ApplyLogOnInfo(crtableLogoninfo)

Next

Laporan.CRV.ReportSource = cryRpt

Laporan.CRV.Refresh()

Laporan.Show()

'Laporan.CRV.ReportSource = Nothing

'Laporan.CRV.RefreshReport()

End Sub

End Class











percobaan diatas itu waktu tampil di formLaporan gak langsung terupdate ato ke refresh gan.. harus ane refresh n save dr program crystal reportnya..



apakah ada yg salah penempatan posisi coding ato ada yang kurang gan di situ ??

tolong bantuannya gan ..

thanks :handshake:

</div>