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
| Dim RP As New Microsoft.Reporting.WinForms.ReportViewer
Dim deviceInfo As String
Dim mimeType As String = Nothing
Dim encoding As String = Nothing
Dim extension As String = Nothing
Dim streamids() As String = Nothing
Dim warnings() As Microsoft.Reporting.WinForms.Warning = Nothing
Dim connString As String = "Server=127.0.0.1;Database=base_Test;Uid=root;Pwd=;"
Dim conn As MySqlConnection = New MySqlConnection
Dim da As New MySqlDataAdapter
Dim Ds As New DataSet1
Dim sComm As New MySqlCommand
conn.ConnectionString = connString
If conn.State = ConnectionState.Closed Then
conn.Open()
End If
sComm.CommandText = "SELECT * FROM base_test.table_impression"
sComm.Connection = conn
da.SelectCommand = sComm
da.Fill(Ds.Tables(0))
RP.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Local
RP.LocalReport.ReportPath = "C:\temp\Report2.rdlc"
RP.LocalReport.DataSources.Clear()
RP.LocalReport.DataSources.Add(New Microsoft.Reporting.WinForms.ReportDataSource("DataSet1", Ds.Tables(0)))
RP.DocumentMapCollapsed = True
RP.RefreshReport()
deviceInfo = ""
Dim tmpbytes() As Byte = RP.LocalReport.Render("PDF", deviceInfo, mimeType, encoding, extension, streamids, warnings)
Dim fs As New System.IO.FileStream("c:\temp\test2.pdf", System.IO.FileMode.Create)
fs.Write(tmpbytes, 0, tmpbytes.Length)
fs.Close() |