如何通过文本框从报表中筛选数据?

时间:2019-05-17 10:20:49

标签: mysql sql vb.net

我打算提出一份报告,在这种情况下,有一位客户的帮助出现了,但此刻所有的帮助都出现了,而不是我选择的一位客户。

Imports System.Data.SqlClient

Public Class Form5
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Const cs As String = "Data Source=(LocalDB)\MSSQLLocalDB;" &
           "AttachDbFilename=C:\Users\Utilizador\Documents\InfTek_Store.mdf;" &
           "Integrated Security=True;" &
           "Connect Timeout=30"
        Dim con As New SqlConnection(cs)
        con.Open()

        Dim sql As String = "Select NumAssis, Data, Tempo, Descricao, Solucao, Estado from Assistencias Where Cliente = '" & TextBox1.Text & "'"
        Dim sqlcom As New SqlCommand(sql, con)
        Try
            sqlcom.Fill(Me.Form5.Assistencias)
        Catch ex As Exception
        End Try
    End Sub
End Class

0 个答案:

没有答案