Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27027

[RESOLVED] How to get sum of a database solumn between two days?

$
0
0
Rather simple task which I can't solve...

VB Code:
  1. Dim sum_fld As Long = 0
  2.         Dim fr_day As Date = DateTimePicker1.Text
  3.         Dim to_day As Date=  DateTimePicker2.Text
  4.  
  5.  
  6.         Dim con As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\dbase.mdb")
  7.         Dim com As OleDbCommand = Nothing
  8.  
  9.             con.Open()
  10.             com = New OleDbCommand("SELECT SUM(points) FROM table WHERE [ws_date] BETWEEN" & Chr(34) & fr_day & "AND" & Chr(34) & to_day & Chr(34), con)
  11.  
  12.            >>>>>> what to put here??<<<<<<<<<<
  13.  
  14.     textbox1.Text= sum_fls.ToString
  15.        
  16. Catch ex As Exception
  17.             If con.State = ConnectionState.Open Then
  18.                 con.Close()
  19.             End If
  20.         End Try

I want to put sum of "points" row from table into textbox.

Viewing all articles
Browse latest Browse all 27027

Trending Articles