reg SQL query
- From: "Ramkumar" <ramkumar@xxxxxxxxxxx>
- Date: Mon, 16 Mar 2009 11:00:00 +0530
Hi
During the FORM LOAD i'm loading the months and the current year in the combobox and text box respectively. The coding for month and year is given below.
For MONTH:
Dim i As Integer
For i = 1 To 12
combo1.AddItem Format(DateSerial(Year(Date), i, 1), "MMMM")
Next
For YEAR:
Dim i As Integer
Dim currentYear As Integer
currentYear = Year(Now)
txtYear.Text = currentYear
I need to connect the both to an SQL query.
I connected the YEAR to SQL query as
curYear = txtYear.text
But i don't know to connect the month with the SQL query.
The SQL query is given below
SELECT CONVERT(CHAR(25),TravelDate,103) as [Journey Date],EID
,Surname,Forename,' ' + RTRIM(FromAd) AS [From Adr], FromPostCode, ' '+
RTRIM(ToAd) AS [To Adr],ToPostCode FROM Journey
WHERE (MONTH(Journey.TravelDate) = " ? ")
AND (YEAR(Journey.TravelDate) = " & curYear & ")
AND (MileageInward IS Null OR MileageInward=0 OR
(ReturnJny=1 AND (MileageOutward IS Null OR MileageOutward=0)))
ORDER BY TravelDate, CallSignIn, AppTime, FromPostCode
I AM USING VISUAL BASIC 5.0. SO ANYONE CAN HELP TO GET RID OF THIS PROBLEM....
Reply ASAP.
Thanks in advance.
Regards,
Ram
.
- Follow-Ups:
- Re: reg SQL query
- From: argusy
- Re: reg SQL query
- Prev by Date: Re: how to connect month combobox with the SQL query
- Next by Date: Re: reg SQL query
- Previous by thread: how to connect month combobox with the SQL query
- Next by thread: Re: reg SQL query
- Index(es):
Relevant Pages
|