473,322 Members | 1,690 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.

"DataTable.Select(String*)" criteria

I'm working with a dataset table populated with people name which contains
"'" and "%" symbols. How can i filter my table with Select method? These
symbols aren't supported by a simple string like

string name = "Francesc'one";
DataRow[] filteredRows = ds.Tables["Contacts"].Select("Name = '" + name +
"'");
Nov 17 '05 #1
7 25429
hi ,
maybe its gonna help you
string t =dt.DefaultView.Sort.Substring(1);

t=t.Substring(0,t.LastIndexOf("]")) ;

dt.DefaultView.RowFilter = t + " LIKE '" + txtSearch.Text + "%'" ;

"TastoEsc" <Ta******@discussions.microsoft.com> wrote in message
news:40**********************************@microsof t.com...
I'm working with a dataset table populated with people name which contains
"'" and "%" symbols. How can i filter my table with Select method? These
symbols aren't supported by a simple string like

string name = "Francesc'one";
DataRow[] filteredRows = ds.Tables["Contacts"].Select("Name = '" + name +
"'");

Nov 17 '05 #2
hi ,
maybe its gonna help you
string t =dt.DefaultView.Sort.Substring(1);

t=t.Substring(0,t.LastIndexOf("]")) ;

dt.DefaultView.RowFilter = t + " LIKE '" + txtSearch.Text + "%'" ;

"TastoEsc" <Ta******@discussions.microsoft.com> wrote in message
news:40**********************************@microsof t.com...
I'm working with a dataset table populated with people name which contains
"'" and "%" symbols. How can i filter my table with Select method? These
symbols aren't supported by a simple string like

string name = "Francesc'one";
DataRow[] filteredRows = ds.Tables["Contacts"].Select("Name = '" + name +
"'");

Nov 17 '05 #3
Sorry, i don't understand how to use your suggestion. Could you tell me more,
please? :)

"Hasan O" wrote:
hi ,
maybe its gonna help you
string t =dt.DefaultView.Sort.Substring(1);

t=t.Substring(0,t.LastIndexOf("]")) ;

dt.DefaultView.RowFilter = t + " LIKE '" + txtSearch.Text + "%'" ;

"TastoEsc" <Ta******@discussions.microsoft.com> wrote in message
news:40**********************************@microsof t.com...
I'm working with a dataset table populated with people name which contains
"'" and "%" symbols. How can i filter my table with Select method? These
symbols aren't supported by a simple string like

string name = "Francesc'one";
DataRow[] filteredRows = ds.Tables["Contacts"].Select("Name = '" + name +
"'");


Nov 17 '05 #4
Sorry, i don't understand how to use your suggestion. Could you tell me more,
please? :)

"Hasan O" wrote:
hi ,
maybe its gonna help you
string t =dt.DefaultView.Sort.Substring(1);

t=t.Substring(0,t.LastIndexOf("]")) ;

dt.DefaultView.RowFilter = t + " LIKE '" + txtSearch.Text + "%'" ;

"TastoEsc" <Ta******@discussions.microsoft.com> wrote in message
news:40**********************************@microsof t.com...
I'm working with a dataset table populated with people name which contains
"'" and "%" symbols. How can i filter my table with Select method? These
symbols aren't supported by a simple string like

string name = "Francesc'one";
DataRow[] filteredRows = ds.Tables["Contacts"].Select("Name = '" + name +
"'");


Nov 17 '05 #5
Use the escape syntax,

string SelectStr = "Hello Forum\'s";

to make Hello Forum's

Does this help ?
"TastoEsc" wrote:
Sorry, i don't understand how to use your suggestion. Could you tell me more,
please? :)

"Hasan O" wrote:
hi ,
maybe its gonna help you
string t =dt.DefaultView.Sort.Substring(1);

t=t.Substring(0,t.LastIndexOf("]")) ;

dt.DefaultView.RowFilter = t + " LIKE '" + txtSearch.Text + "%'" ;

"TastoEsc" <Ta******@discussions.microsoft.com> wrote in message
news:40**********************************@microsof t.com...
I'm working with a dataset table populated with people name which contains
"'" and "%" symbols. How can i filter my table with Select method? These
symbols aren't supported by a simple string like

string name = "Francesc'one";
DataRow[] filteredRows = ds.Tables["Contacts"].Select("Name = '" + name +
"'");


Nov 17 '05 #6
Use the escape syntax,

string SelectStr = "Hello Forum\'s";

to make Hello Forum's

Does this help ?
"TastoEsc" wrote:
Sorry, i don't understand how to use your suggestion. Could you tell me more,
please? :)

"Hasan O" wrote:
hi ,
maybe its gonna help you
string t =dt.DefaultView.Sort.Substring(1);

t=t.Substring(0,t.LastIndexOf("]")) ;

dt.DefaultView.RowFilter = t + " LIKE '" + txtSearch.Text + "%'" ;

"TastoEsc" <Ta******@discussions.microsoft.com> wrote in message
news:40**********************************@microsof t.com...
I'm working with a dataset table populated with people name which contains
"'" and "%" symbols. How can i filter my table with Select method? These
symbols aren't supported by a simple string like

string name = "Francesc'one";
DataRow[] filteredRows = ds.Tables["Contacts"].Select("Name = '" + name +
"'");


Nov 17 '05 #7
Hi,

Straight out of DataColumn.Expression help topic:
" If the string in a LIKE clause contains a * or %, those characters should
be escaped in brackets ([]). "

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
SLODUG - Slovene Developer Users Group www.codezone-si.info

"TastoEsc" <Ta******@discussions.microsoft.com> wrote in message
news:40**********************************@microsof t.com...
I'm working with a dataset table populated with people name which contains
"'" and "%" symbols. How can i filter my table with Select method? These
symbols aren't supported by a simple string like

string name = "Francesc'one";
DataRow[] filteredRows = ds.Tables["Contacts"].Select("Name = '" + name +
"'");

Nov 17 '05 #8

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

Similar topics

3
by: Antonio Ooi | last post by:
Hi, I get a DataTable based on this simple query: SELECT * FROM Customers Later, I want to know just the table name because I do not want to play with the string within the SELECT statement....
3
by: beta | last post by:
Hello everyone, I need some help here. If anyone has encountered this, knidly give me your advice. I have a command button (Command0) and a listbox (List1). Upon clicking the command button,...
2
by: Derrick | last post by:
or is there some other MaxRows type of prop so you can limit result set? Thanks in advance! Derrick
0
by: TastoEsc | last post by:
I'm working with a dataset table populated with people name which contains "'" and "%" symbols. How can i filter my table with Select method? These symbols aren't supported by a simple string like...
3
by: Reney | last post by:
I am using Access Database in my program. The column in the table that I am going to use has date/time value with Medium Time selected. (HH:mm). The program is recording a clock in time to this...
7
by: Alex Maghen | last post by:
I have some client-side JavaScript that I want to run whenever a pulldown <SELECT> is changes on th client. I'm trying to do this as follows... <select id="MyPulldown"...
2
by: slinky | last post by:
I'm getting a error when I open my . aspx in my browser... line 34: da.Fill(ds, "Assets") Here's the error and my entire code for this .aspx.vb is below that ... I need some clues as to what is...
2
by: gggram2000 | last post by:
//When cbxInvNum is changed, it will display all fields on dgDisplay datagrid from SaleReceipts Table where invoice number = to the selected invoice number string sql = "SELECT * WHERE InvoiceNumber...
7
by: Mitzvetsia | last post by:
I'm trying to allow database users to click on a button on a form and send e-mail to certain clients based on what criteria they select from a drop-down box on said form. The send e-mail function...
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...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
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...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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...

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.