473,322 Members | 1,736 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Can we write custom function to filter rows from DataTable

Hi,
Can we write custom function to filter rows from DataTable Select
method?

Actually my need is to format the row value
from
(901) 789 1234<BR>(901) 789 1235<BR>(901) 789 1221
to
9017891234<BR>9017891235<BR>9017891221
(removing all formatting strings)

I've tried in SQL with Replace function. But giving Unknown Function
REPLACE() error in trying to run in DataTable Select method.

How can we write a custom function to format the string if any
possible....

Thanks in Advance
- ArunDhaJ
Jul 4 '08 #1
1 2163
"ArunDhaJ" <ar******@gmail.comwrote in message
news:8e**********************************@e39g2000 hsf.googlegroups.com...
Actually my need is to format the row value
from
(901) 789 1234<BR>(901) 789 1235<BR>(901) 789 1221
to
9017891234<BR>9017891235<BR>9017891221
(removing all formatting strings)

I've tried in SQL with Replace function. But giving Unknown Function
REPLACE() error in trying to run in DataTable Select method.

How can we write a custom function to format the string if any
possible....
Several ways, of which a regular expression is probably the most efficient.

However, something like this will also work:

string strRaw = "(901) 789 1234<BR>(901) 789 1235<BR>(901) 789 1221";
string strFiltered = strRaw.Replace("(", "").Replace(" ", "").Replace(")",
"");
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jul 4 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: localhost | last post by:
I have a static, thread-safe class with a DataSet as a property. When the class is instanced into an object, some callers add rows to a DataTable in the DataSet. Other callers read the DataSet. ...
3
by: Dan V. | last post by:
How can I use real SQL on a DataTable? i.e. not array of rows using a filter... as in DataTable.Select. I read at : microsoft.public.dotnet.framework.adonet "As others have posted: There is no...
3
by: MrNobody | last post by:
I've read that the expression property for DataColumns is used to "Sets or retrieves the expresssion used to filter rows, calculate the values in a column, or create an aggregate column.". I...
1
by: werk | last post by:
For limiting access to the database to strictly necessary I try to filter the query by using DataView. Thw DataSet ds contains three columns (fields) : (LAND_ID, Landcode, Landnaam) and four...
1
by: nate axtell | last post by:
In VB .Net I made a custom CheckBox column style (for the Datagrid control) that maps to two DataTable columns , one it uses for the Checked status and the other it uses for the Enabled status. I am...
2
by: AMDRIT | last post by:
Hello everyone, I have created a custom component and one of its properties is a class object with it's own properties. During runtime, I can assign values to the class object properties just...
2
by: Paul | last post by:
Hi all, I have a DataTable and a DataGridView that is using it as a datasource. I'm using the DataTable.Select method and I can find some rows. Is it now possible, somehow to use the result of the...
4
by: ArunDhaJ | last post by:
Hi, I've to filter rows from DataTable Select There is a column named "Phone" which contains values in the following format: (901) 789 1234<BR>(901) 789 1235<BR>(901) 789 1221 I need to...
1
by: Charles Law | last post by:
I have a base class MyBaseClass, and several classes that inherit from it: MyClass1, MyClass2, etc. The base class implements IEnumerable(Of IMyBaseClassRow). The base class has a DataTable...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.