M
Marty McFly
Greetings,
I'm trying to let my users dynamically filter records from a table that
relate to other tables.
RELATIONSHIPS:
[CustomersTable].[CustomerID] = [OrdersTable].[CustomerID]
[SalesRepsTable].[SalesRepID] = [OrdersTable].[SalesRepID]
There is a Many-to-Many relationship between CustomersTable and
SalesRepsTable.
On my Windows form, I basically dump all the SQL Server column names as text
boxes and check boxes to give users the ability to filter and sort on
anything they wish.
However, when I establish the relationship between Customers and SalesReps,
the RowFilter property of the dvCustomers DataView can get quite lengthy. I
tested the actual RowFilter statement, and it checks out. It only errors
off when the RowFilter is applied. An example:
dvCustomers.RowFilter = "CustomerID=32 OR CustomerID=434 OR
CustomerID=4955..."
The largest RowFilter I've successfully set so far contained 231 CustomerID
values. The next largest I tried (384 CustomerIDs) failed with the
following error: "An unhandled exception of type
'System.StackOverflowException' occurred in system.windows.forms.dll"
Because this is a M:M relationship, there is no way to get around the length
of the RowFilter string. For each value, I have to query the OrdersTable
and SalesRepsTable just to get the CustomerID. Does anyone have any ideas
on how to get this to work? Also, is the RowFilter limited by length,
number of parameters, or something completely different?
Many thanks,
Marty McFly
I'm trying to let my users dynamically filter records from a table that
relate to other tables.
RELATIONSHIPS:
[CustomersTable].[CustomerID] = [OrdersTable].[CustomerID]
[SalesRepsTable].[SalesRepID] = [OrdersTable].[SalesRepID]
There is a Many-to-Many relationship between CustomersTable and
SalesRepsTable.
On my Windows form, I basically dump all the SQL Server column names as text
boxes and check boxes to give users the ability to filter and sort on
anything they wish.
However, when I establish the relationship between Customers and SalesReps,
the RowFilter property of the dvCustomers DataView can get quite lengthy. I
tested the actual RowFilter statement, and it checks out. It only errors
off when the RowFilter is applied. An example:
dvCustomers.RowFilter = "CustomerID=32 OR CustomerID=434 OR
CustomerID=4955..."
The largest RowFilter I've successfully set so far contained 231 CustomerID
values. The next largest I tried (384 CustomerIDs) failed with the
following error: "An unhandled exception of type
'System.StackOverflowException' occurred in system.windows.forms.dll"
Because this is a M:M relationship, there is no way to get around the length
of the RowFilter string. For each value, I have to query the OrdersTable
and SalesRepsTable just to get the CustomerID. Does anyone have any ideas
on how to get this to work? Also, is the RowFilter limited by length,
number of parameters, or something completely different?
Many thanks,
Marty McFly