Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2007-03-27
4
Medium Priority
?
699 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 2000 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

618 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