masyanto

reportviewr rdlc

Nov 28th, 2020
608
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Imports MySql.Data.MySqlClient
  2. Imports System.ComponentModel
  3. Imports Microsoft.Reporting.WinForms
  4. Public Class FormTandaTerimaTU
  5.     Private Sub ButtonCetak_Click(sender As Object, e As EventArgs) Handles ButtonCetak.Click
  6.         Try
  7.             'hapus data
  8.             conn.Open()
  9.             sstr = "call sp_CRUD_tblkas_temp (@p1)"
  10.             cmd = New MySqlCommand(sstr, conn)
  11.             cmd.Parameters.Add("@p1", MySqlDbType.String, 11).Value = FormSK.DGVTU.Rows(i).Cells("colidkastu").Value
  12.             cmd.ExecuteNonQuery()
  13.             MsgBox("No.Reff " + FormSK.DGVTU.Rows(i).Cells("ColreffV").Value + " berhasil di Terima")
  14.             conn.Close()
  15.  
  16.         Catch ex As Exception
  17.             MsgBox(ex.ToString)
  18.         End Try
  19.     End Sub
  20.  
  21.     Private Sub FormTandaTerimaTU_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing
  22.         ReportViewer1.RefreshReport()
  23.     End Sub
  24.     Sub TampilCetak()
  25.         Try
  26.             conn.Open()
  27.             sstr = "select tgltrx,notrx,kettrx,nominaltrx from v_tblkastu_temp where notrx='" & Txtnotrx.Text & "'"
  28.             da = New MySqlDataAdapter(sstr, conn)
  29.             dt = New DataTable
  30.             da.Fill(dt)
  31.             ReportViewer1.LocalReport.DataSources.Clear()
  32.             Dim rpt As New ReportDataSource("TandaterimaTU", dt)
  33.             ReportViewer1.LocalReport.DataSources.Add(rpt)
  34.             ReportViewer1.Refresh()
  35.  
  36.             conn.Close()
  37.         Catch ex As Exception
  38.             MsgBox(ex.ToString)
  39.         End Try
  40.     End Sub
  41.     Private Sub FormTandaTerimaTU_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  42.         Me.ReportViewer1.RefreshReport()
  43.     End Sub
  44.  
  45.     Private Sub ReportViewer1_Load(sender As Object, e As EventArgs) Handles ReportViewer1.Load
  46.         TampilCetak()
  47.     End Sub
  48.  
  49. End Class
RAW Paste Data