Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

I want to execute a SQL command using the DataTable.Select command on my datatable. Problem is my column contains data that contains asterisks (*).

 

I want to select all data that contains an asterisk (*).

 

My current command looks like: myTable.Select("column0 like '%*'") but this returns all rows when it should only return the single row that actually meets my requirements.

 

So, I tested.

 

1. myTable.Select("column0 like '*'") returns all rows. (didn't know that)

2. myTable.Select("column0 like '%'") returns all rows. (Yes, i knew that)

3. myTable.Select(@"column0 like '%\*'") returns nothing.

4. myTable.Select(@"column0 like '%/'*") returns nothing.

 

I think I need some escape character before the asterisk. Any help?

 

btw, i'm using C#.

Edited by kasdoffe

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...