如何将数据从db加载到vb.net中的crystal报表

时间:2018-02-10 13:55:59

标签: database vb.net datatable combobox crystal-reports

 viewdata.Visible = True
    Dim a As String = fromdtp.Value.ToString("MM/dd/yyyy")
    Dim b As String = Todtp.Value.ToString("MM/dd/yyyy")
    Dim type As String = sel.SelectedItem.ToString()
    If sel.SelectedItem.ToString = "allitems" Then

        Dim searchQuery As String = "SELECT * From entry where delivery between '" & a & "' and '" & b & "' "
        MessageBox(searchQuery)

        Dim cmd As New SqlCommand(searchQuery, con)
        Dim adapter As New SqlDataAdapter(cmd)
        Dim table As New DataTable()

        adapter.Fill(table)
        viewdata.DataSource = table

    Else
        Dim searchQuery As String = "SELECT * From entry where p_name='" & type & "' and delivery between '" & a & "' and '" & b & "' "
        MessageBox(searchQuery)

        Dim cmd As New SqlCommand(searchQuery, con)
        Dim adapter As New SqlDataAdapter(cmd)
        Dim table As New DataTable()

        adapter.Fill(table)
        viewdata.DataSource = table
    End If


    Form3.Show()

        fromdtp.Value = Date.Now
        Todtp.Value = Date.Now

这是我的表单代码,点击按钮后我想根据查询生成报告 我想将数据从Sqlserver加载到VB.net中的Crystal Report

0 个答案:

没有答案