Code: dt.Select(“Username LIKE '”+username+“’ AND Description like ‘Unsuccessful attempt to login by user’ OR ‘User Limit Reached’”).copytodatatable
I want to select rows that contains these values: ‘Unsuccessful attempt to login by user’, ‘User Limit Reached’’
My code has no error but it doesn’t work. Is there a way?
Thank you xoxo
palindrome
(Nitin Safaya)
December 5, 2018, 3:07pm
2
I was facing the same issue, I mean copytodatatable was not working as it supposed to be in C#. I solved it using this method:
datarow[] rowValues = dt.Select(“Username LIKE '”+username+"’ AND Description like ‘Unsuccessful attempt to login by user’ OR ‘User Limit Reached’");
datatable new_dt = dt.Clone();
foreach datarow row in rowValues { new_dt.Add(row.ItemArray); }
Below is the screenshot to achieve it:
Use percentage symbol before and after the search string.
dt.Select(“Username LIKE '%”+username+“%’ AND Description like ‘%Unsuccessful attempt to login by user%’ OR ‘%User Limit Reached%’”).copytodatatable
Hi, it is not about the *.
This code works:
dt.Select(“Username LIKE '”+username+“’ AND Description like ‘Unsuccessful attempt to login by user’”).Length > 0
But how to write if the description column can either have value A or value B in that code?
Thank you for help. It was useful.
However, my .copytodatatable works as I amended the xaml file so that is not the problem here
dt.Select(“Username LIKE '%”+username+“%’ AND Description like ‘%Unsuccessful attempt to login by user%’ OR ‘%User Limit Reached%’”).copytodatatable
@palindrome
how do I select the dt opposite of the query? E.g. i want the dt to select rows that doesn’t match to above conditions
How do i use it in that code?
palindrome
(Nitin Safaya)
December 7, 2018, 1:31am
10
abc.Select(“[Column1] <> ‘text’”)
@palindrome sorry, pls elaborate what will that do?
palindrome
(Nitin Safaya)
December 7, 2018, 2:16am
12
dt.Select(“Username LIKE '%”+username+“%’ AND Description not like ‘%Unsuccessful attempt to login by user%’ OR ‘%User Limit Reached%’”).
1 Like
system
(system)
Closed
December 10, 2018, 2:17am
13
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.