|
-
February 19th, 2009, 04:22 AM
#1
SQL between statement
I had two combo box..The first combo box is showing the month(eg.01,02,03---12) and another combo box is showing year(eg.2009,2010,2011).....
I had the following code:
Code:
conKk.Open()
'Dim strReportPath As String = "C:\Documents and Settings\Chee Mun\Desktop\FYPvb\FYP\CrystalReport1.rpt"
Dim mySelect As SqlCommand
mySelect = New SqlCommand("Select * from Payment Where PaymentDate Between '" & cbo1.text &"' And '" & cbo2.text &"'", conKk)
Dim mySqlDataAdapter As New SqlDataAdapter(mySelect)
Dim mydsPayment As New DataSet1
mySqlDataAdapter.Fill(mydsPayment, "Payment")
In my database,my PaymentDate is combination of date,month and year(Eg.30/12/2009)...SO how can i change the SQL statement based on what i choose from combo box 1 and combo box 2 to retrieve data?It means that if i choose 02 and 2009,the sql will retrieve those data that within feb 2009?
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
|