rowfilter

Injection Attacks against .NET DataView RowFilter

So I'm writing a handler that filters a cached DataTable based on the AppRelativeCurrentExecutionFilePath using the DataView RowFilter property. What's the best way to encode the input to prevent an injection attack? Is the following sufficient? Is there a better/more-elegant way? dataView.RowFilter = String.Format("Name LIKE '{0}%'"...

JTable RowFilter

Is is possible to some how get the index of the selection corresponding to the non filtered table? After the table is filter using a regexFilter. JTable getSelectedRow returns the index of the filtered table? ...

Why doesn't COALESCE work with RowFilter?

Hi. I'm developing a small application in WPF. I have a ListBox named NameListBox whose ItemsSource property is set to a DataView, and thus displays a list of customer names. The name is composed of 3 parts: FirstName, MiddleName, and LastName. I have used a converter to display the full name of customer in the list. Everything works fin...

Difference between ADO.NET 1.0 and 3.5 using RowFilter and strings?

I have recently been tasked with upgrading an application from .net 1.1 to 3.5 and came across a RowFilter on a DataView that had a different behavior between the two versions. Here is my code block in 1.1 that works in 1.1 but not 3.5. I get the following error trying to run this in 3.5 "Cannot perform '=' operation on System.String a...

DataView.RowFilter an ISO8601

I have a DataTable (instance named: TimeTable) whose DefaultView (instance named: TimeTableView) I am trying to use to filter based on a date. Column clock_in contains an ISO8601 formatted string. I would like to select all the rows in this DataTable/DefaultView between 2009-10-08T08:22:02Z and 2009-10-08T20:22:02Z. What would I have to...

Why is my datagridview.rowfilter not working. I keep getting a syntax error message

My application has a populated datatable and binds it to a ddatagridview by setting the datasource property. At run time I want to filter this table. When the user clicks a button I run the following code: dataManager.VDMSTables.DataTable.DefaultView.RowFilter = column + " LIKE '%" + criteria + "%'"; All the classes are populated cor...

Filtering by date with DataTable.RowFilter while ignoring time

How do I filter for records on a DataTable which are on a certain date? I've tried plain [datecol] = #11 March 2010# and CONVERT([datecol],'System.DateTime') = #11 March 2010#. With no luck. MSDN: RowFilter Expression Syntax Solution [datecol] >= #11 March 2010 00:00# AND [datecol] <= #11 March 2010 23:59:59# ...

RowFilter.regexFilter multiple columns

I am currently using the following to filter my JTable RowFilter.regexFilter( Pattern.compile(textField.getText(), Pattern.CASE_INSENSITIVE).toString(), columns ); How do I format my textField or filter so if I want to filter multiple columns I can do that. Right now I can filter multiple columns but my filter ...

RowFilter including [ character in search string

I fill a DataSet and allow the user to enter a search string. Instead of hitting the database again, I set the RowFilter to display the selected data. When the user enters a square bracket ( "[" ) I get an error "Error in Like Operator". I know there is a list of characters that need prefixed with "\" when they are used in a field nam...

How to filter rows in JTable based on boolean valued columns?

Im trying to filter rows based on a column say c1 that contains boolean values. I want to show only rows that have 'true' in c1. I looked up the examples in http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#sorting. The example uses a regex filter. Is there any way I can use boolean values to filter rows? Following i...

DataView.Filter not working with multiple % in "like %"?

Below SQL query works when the spaces in the role name are replaced by %: 1 row is returned select * from cmrdata.dbo.tblRoles where rolename like '%Super%Administrator%' However, when I try to mimic the same in DataView.RowFilter, it does not return any rows. dv.RowFilter = "RoleName like '[%]" & Replace(roleName, " ", "[%]") & "[%]...

RowFilter set on combobox itemsprovider affects all rows

Hi, I have a problem with my project using Infragistics WPF control, but it's more general to WPF, so I am asking the question here. In my grid I have a column with combobox as editor. In XAML, I set DisplayMemberPath and ValuePath in ItemsProvider, so user sees display name, but internally value code is stored in the grid. The proble...

How to filter a dataview

I have a dataview that contains a list of tables. I am reading in a list of values that I then want to apply as a filter to this dataview. The list of values is actually in the form of "table1, table2, table3". So I thought I would be able to use this as a filter on my dataview. SqlOp.CommandText = "select name from dbo.sysobjects where...

Compare dates in DataView.RowFilter ?

I am scratching my head over something rather stupid yet apparently difficult. DataView dvFormula = dsFormula.Tables[0].DefaultView; dvFormula.RowFilter = "'" + startDate.ToString("yyyyMMdd") + "' < EndDate OR EndDate = '19000101'"; dvFormula.Sort = "FromDate ASC"; The result is this: Cannot perform '<' operation on System.String ...

How can I filter a DataColumn on a TimeSpan value?

Programming in C#.NET. I have a DataTable with a column named Time which is of type System.TimeSpan. When I display the DataTable in a DataGridView I want to filter out all the entries that don't have a time listed. I have tried the following but to no avail. Can you help? DataView myDataView = new DataView(SomeDataTable); myDataView.Ro...

WPF Datagrid: Rowfilter for Lists/Collections

I recently migrated all my Datatables to List(Of), and bind it using .ItemSource. This works perfectly, but I run into a problem. Previously, I could filter the rows with SQL-like statements like this: Dim dk As DataView dk = DataGrid1.ItemsSource dk.RowFilter = "ID > 10" Now that I am using List(Of), i cannot use the rowfilter proper...

DataTable Filtering

Hi, I have a method that gets a list of numbers and filters my datatable according to it. I use this code: string MyQuery = CreateQueryMethod(MyNumbersList); MyDataTable.DefaultView.RowFilter = MyQuery; But if I get an empty list, MyQuery is just: "" // (string.empty) and if RowFilter is an empty string it shows the entire datatabl...

Paging attribute in GridView filtered data is not working.

Hello, How can I enable the paging feature of a gridview that has been filtered using a dataview source. The paging on the default view is working fine. However, when the user inputs a value to be used in filtering the data, the paging reverts back to the original datasource even after the databind has been called. The following code ac...