VB.Net + SQL + MS.Access Help

djruski

New member
Joined
Sep 7, 2005
Messages
1
Programming Experience
Beginner
Hey guys,

I'm creating a program which retrieves data from a database, and then creates a HTML file of that data in separate columns.

However I'm having trouble with my SQL statements and the DateTime functions. The idea of the program is, for the user to enter a Month and Year (in textboxes), and what they enter goes into the SQL statement, and then the data from the database in MS.Access is retrieved between those dates, and displayed in the HTML file.

So far,I've managed to get the data to display in the HTML file, under separate columns etc... But can't figure out how to retrieve data between the user entered dates.

The format of the dates/time is as such:

appointmentID dateOfappointment timeOfappointment
16932 17/08/2005 11:00:00 AM

If possible, the program should allow the user to be able to enter the Month in Letters, and not just numbers.. ie Jan/January/1.

Any help would be greatly appreciated.
 
Why not use two DateTimePickers for the StartDate and EndDate? These can be displayed as Long which means they will show '7 September 2005' to the user.

Private Sub btnLoadData_Click(.............)

StartDate = dtpStartDate.value
EndDate = dtpEndDate.value

me.dataAdapter1.SelectCommand.Parameters("@Date1").value = dtpDate1.value
me.dataAdapter1.SelectCommand.Parameters("@Date2").value = dtpDate2.value

The SQL String would be;

Select ......... FROM .......... WHERE DateField1 >=@Date1 AND <=@Date2


That's how I'm doing it and it all works perfectly...but I use global variables for a StartDate and EndDate as they are selected on a modal form.

Hope it's helpful.
Luke
 
Back
Top