Quantcast
Viewing all articles
Browse latest Browse all 27034

Select row from DataView querying with 'Date'

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

Viewing all articles
Browse latest Browse all 27034

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>