每天每周和每月从datagridview过滤数据

时间:2018-01-20 07:29:53

标签: vb.net

有人帮助我。我希望按每日,每周和每月在datagridview中显示数据,并在InstallmentAmount列上计算总金额。  请帮忙

enter image description here

1 个答案:

答案 0 :(得分:0)

请查看Snap

这是代码,

    Dim ds As DataSet = New DataSet
    Dim da As OleDbDataAdapter
    Dim tables As DataTableCollection = ds.Tables
    Dim source1 As New BindingSource()

    da = New OleDbDataAdapter("Select [InstallmentDate], [CustomerID], [CustomerName], [InstallmentNumber], [InstallmentAmount] from VoucherEntrytbl", conn)
    da.Fill(ds, "VoucherEntrytbl")

    Dim view1 As New DataView(tables(0))
    source1.DataSource = view1
    dgvBSDaily.DataSource = view1
    dgvBSDaily.Refresh()

    source1.Filter = DateTimePicker3.Value.Date
    DataGridView1.Refresh()