首页 > 解决方案 > 如何使用 SQL 在报表查看器中添加图像

问题描述

我正在使用带有 SQL Server 的 VB.Net 2013

我的代码有什么问题?有什么遗漏吗?

当我尝试选择位置时,它会在表单中显示名称、位置和图像。
一切看起来都很好,唯一的问题是报表查看器中的图像没有改变。

Imports System.IO
Imports Microsoft.Reporting.WinForms

Public Class Form1

    Private Sub Table_locationBindingNavigatorSaveItem_Click(sender As Object, e As EventArgs) Handles Table_locationBindingNavigatorSaveItem.Click
        Me.Validate()
        Me.Table_locationBindingSource.EndEdit()
        Me.TableAdapterManager.UpdateAll(Me.KankonDataSet)

    End Sub

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'KankonDataSet.Table_location' table. You can move, or remove it, as needed.
        Me.Table_locationTableAdapter.Fill(Me.KankonDataSet.Table_location)

        If NamelocationComboBox.Text = Nothing Then
            NamelocationComboBox.Text = "No thing"
        End If

        If IdlocationTextBox.Text = Nothing Then
            IdlocationTextBox.Text = "No thing"
        End If

        Dim Param1 As New ReportParameter("ReportParameterlocation", NamelocationComboBox.Text)
        ReportViewer1.LocalReport.SetParameters(Param1)
        Dim Param2 As New ReportParameter("ReportParameterwhere", IdlocationTextBox.Text)
        ReportViewer1.LocalReport.SetParameters(Param2)

        Me.ReportViewer1.RefreshReport()
    End Sub

    Private Sub ReportViewer1_Load(sender As Object, e As EventArgs) Handles ReportViewer1.Load
        Me.ReportViewer1.RefreshReport()
    End Sub

    Private Sub NamelocationComboBox_SelectedIndexChanged(sender As Object, e As EventArgs) Handles NamelocationComboBox.SelectedIndexChanged
        Dim Param1 As New ReportParameter("ReportParameterlocation", NamelocationComboBox.Text)
        ReportViewer1.LocalReport.SetParameters(Param1)
        Me.ReportViewer1.RefreshReport()
    End Sub

    Private Sub IdlocationTextBox_TextChanged(sender As Object, e As EventArgs) Handles IdlocationTextBox.TextChanged
        Dim Param2 As New ReportParameter("ReportParameterwhere", IdlocationTextBox.Text)
        ReportViewer1.LocalReport.SetParameters(Param2)
        Me.ReportViewer1.RefreshReport()
    End Sub
End Class

图片在附件!

在此处输入图像描述

在此处输入图像描述

标签: vb.net

解决方案


推荐阅读