nsabarisri6
New member
- Joined
- Dec 18, 2012
- Messages
- 4
- Programming Experience
- 1-3
Hi
I have a table which contains a date column called 'PurchaseDate'
I have a list box which displays the months. When I click a month , I need to query the dataSource and collect the rows which have the purchase date in the 'SelectedMonth'.
dv2 = New DataView(ds.Tables(0), "PurchaseDate LIKE '" & SelectedMonth & "/%'", "BillNo", DataViewRowState.CurrentRows)
This code is not working . Because.. here 'PurchaseDate' is in Date format like 'MM/DD/YYYY'.I think I need to convert the date into string before using 'LIKE' operator. I also tried using as below..even then it dint go fine..
dv1 = New DataView(ds.Tables(0), "convert(varchar2(20),PurchaseDate,103) LIKE '" & SelectedMonth & "/%'", "BillNo", DataViewRowState.CurrentRows)
Here 'SelectedMonth' will be a string like '01', '10'..
Kindly help me in this regard..
Thanks,
Sabarisri.N
I have a table which contains a date column called 'PurchaseDate'
I have a list box which displays the months. When I click a month , I need to query the dataSource and collect the rows which have the purchase date in the 'SelectedMonth'.
dv2 = New DataView(ds.Tables(0), "PurchaseDate LIKE '" & SelectedMonth & "/%'", "BillNo", DataViewRowState.CurrentRows)
This code is not working . Because.. here 'PurchaseDate' is in Date format like 'MM/DD/YYYY'.I think I need to convert the date into string before using 'LIKE' operator. I also tried using as below..even then it dint go fine..
dv1 = New DataView(ds.Tables(0), "convert(varchar2(20),PurchaseDate,103) LIKE '" & SelectedMonth & "/%'", "BillNo", DataViewRowState.CurrentRows)
Here 'SelectedMonth' will be a string like '01', '10'..
Kindly help me in this regard..
Thanks,
Sabarisri.N