Solved

How to do a .Select() or set a rowfilter on a Dataset with "Right" function

Posted on 2007-03-27
4
692 Views
Last Modified: 2012-08-13
Goodday,
How can I do a select on a dataset table with the "Right" function on a string ?
Problem now is that the "Right" function is not usable in the rowfilter or a .Select()

Example :
ds.Tables("Overview").DefaultView.RowFilter = "right([Dates],4 = " & dat_year

The table in the dataset ds contains the column Dates in which text is stored like :
"01.01.2005 - 01.02.2005"   and I would like to do a select on the last 4 char.


0
Comment
Question by:RonaldZaal
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 21

Expert Comment

by:tovvenki
ID: 18798618
HI,
instead of checking the year part check the date from 01/01/date_year till 31/01/date_year
startDate as string
endDate as string
startDate = "01/01/" & dat_year
endDate = "31/01/" & dat_year
ds.Tables("Overview").DefaultView.RowFilter = "[Dates] >= " & startDate & " and [Dates] <= " & endDate

I hope that this helps you


Kind Regards
Venki
0
 
LVL 2

Expert Comment

by:alfredwhang
ID: 18798837
try:

1) ds.Tables("Overview").DefaultView.RowFilter = "Date>=#01-01" & Yr & "# AND Date<#01-01" & Yr +1 & "#")

2) ds.RowFilter = "Convert(Date,'System.DateTime') =" & Yr

3) ds.Tables("Overview").DefaultView.RowFilter = "Year(Date) = " & Yr
0
 
LVL 2

Accepted Solution

by:
alfredwhang earned 500 total points
ID: 18798849
sorry:

don't forget the # in 1

and 2) should be:

ds.RowFilter = "(Convert(Date,'System.DateTime')).Year =" & Yr
0
 
LVL 5

Author Comment

by:RonaldZaal
ID: 18836534
To my surprise I left the Q without a note.
Better late then never I guess

Thanks alfredwhang !

0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question