|
-
Apr 12th, 2008, 08:19 AM
#1
Thread Starter
Member
[2005] Datetimerpicker+Access 2000 sql statement
Hey,
I've run into a problem with extracting information from a database and inserting it into a listview. I am unsure if I am using the easiest way.
Problem: I have 2 DateTimePickers and a button. One datetimepicker is for the start date, the other for the finish date. When the button is clicked by the user, I want to check the database for all transactions that have been made between the start date and the finish date. Hope that makes sense, here is the code so far.
Controls:
BtnDatesearch = Button user will click
Startdate = Datetimepicker
Finishdate = datetimepicker
Code:
Private Sub BtnDateSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnDateSearch.Click
Connection.CreateCommand()
Command.CommandText = "SELECT * FROM Transactions WHERE Transaction_Date > " & StartDate.Text & " AND Transaction_Date < " & FinishDate.Text & ""
Reader = Command.ExecuteReader
While (Reader.Read)
Dim value3 As Double = Reader.GetValue(3)
Transactions.Items.Add(New ListViewItem(New String() {Reader.GetValue(0), Reader.GetValue(1), Reader.GetValue(2), value3.ToString("n2"), Reader.GetValue(4), Reader.GetValue(5)}))
End While
Reader.Close()
End Sub
I am not sure if you are able to search in-between 2 date values the way I attempted to, is there another way to do this?
Another quick question if you don't mind.
In Access 2000, how can I change the date format from American to Australian?
Thanks
Last edited by Wulfgur; Apr 12th, 2008 at 07:49 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|