how to update a crystal report report in visual basic

0

I have a customer list report to call the display of the data in the report I use this code:

    Dim crystalrpt As New ReportDocument()
    crystalrpt.Load("C:\Users\Samuel Susana\Documents\Visual Studio 2015\Projects\SistemadeventaPOO\SistemadeventaPOO\CrystalReportclientes.rpt")
    CrystalReportViewer1.ReportSource = crystalrpt
    CrystalReportViewer1.Refresh()

but if in the execution of the program I add a client to my table and then I call that report the client that I added is not shown in the list

    
asked by Samuel Ignacio Susana Confesor 04.08.2017 в 16:04
source

2 answers

0

Here of yew a way to be able to update reports and not work with fixed reports but dynamic.

Sub REPORTE_COMUNICADOS(codigo As String)
    Dim rpt As New ReporteComunicado
    Try
        Dim Tabla As DataSet
        Dim existe As Boolean
        Dim cad As String

        cad = " exec [SP_REPORTE_COMUNICADO] '" & codigo & "' "
        Tabla = lsql.CARGAR_DATASET(cad)
        existe = System.IO.File.Exists("C:\XSD_COLTENE\LOGISTICA\REPORTE_COMUNICADOS.XSD")
        If existe = False Then
            My.Computer.FileSystem.CreateDirectory("C:\XSD_COLTENE")
            My.Computer.FileSystem.CreateDirectory("C:\XSD_COLTENE\LOGISTICA")
            Dim URL As String = "C:\XSD_COLTENE\LOGISTICA\REPORTE_COMUNICADOS.XSD"
            Tabla.WriteXmlSchema(URL)
        End If
        rpt.SetDataSource(Tabla)
        REPORTES_BLANCO.CrystalReportViewer1.ReportSource = rpt
        REPORTES_BLANCO.Text = "REPORTE_COMUNICADOS"
        REPORTES_BLANCO.WindowState = FormWindowState.Maximized
        REPORTES_BLANCO.Show()
    Catch ex As Exception
    End Try
End Sub

then you call the button in this way

imp.REPORTE_COMUNICADOS(codigo)

'your connection [If you block in N layers change to the connection you have in it]

    
answered by 24.10.2018 в 20:18
-1

Here I leave you an image because the code does not look the same.

    
answered by 24.10.2018 в 20:24