Private Sub FormReport_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
DTPstart.Value = DateTime.Today.AddYears(-1)
DTPend.Value = DateTime.Today
End Sub
Private Sub ButtonCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonCalculate.Click
Dim strSQL As String = "SELECT*FROM CashSale WHERE NetTotal BETWEEN ? AND ?"
DTPstart.Value(Convert.ToDateTime(st))
Dim DTPstart As String = DTPstart.Value
Dim para1 As New OleDbParameter("startDate", "st")
da.SelectCommand = New OleDbCommand(strSQL, cn)
Try
da.Fill(ds, "CS")
Catch ex As OleDbException
MsgBox(ex.Message)
Exit Sub
End Try
DGVcashsale.DataSource = ds.Tables("CS")
End Sub
Dim dtAdapter As OleDbDataAdapter
Dim dt As New DataTable
strSQL = "SELECT * FROM files WHERE FilesID = @sFilesID "
dtAdapter = New OleDbDataAdapter(strSQL, objConn)
objCmd = dtAdapter.SelectCommand
objCmd.Parameters.Add("@sFilesID", OleDbType.Integer).Value = Request.QueryString("FilesID")
dtAdapter.Fill(dt)
Private Sub ButtonCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonCalculate.Click
Dim strSQL As String = "SELECT*FROM CashSale WHERE SaleDate BETWEEN @sDate AND @eDate"
da.SelectCommand = New OleDbCommand(strSQL, cn)
cm = da.SelectCommand
cm.Parameters.Add("@sDate", OleDbType.Date).Value = DTPstart.Value
cm.Parameters.Add("@eDate", OleDbType.Date).Value = DTPend.Value
Try
da.Fill(ds, "CS")
Catch ex As OleDbException
MsgBox(ex.Message)
Exit Sub
End Try
DGVcashsale.DataSource = ds.Tables("CS")
End Sub