Maximum parameters?

Posts   
 
    
alexdresko
User
Posts: 336
Joined: 08-Jun-2004
# Posted on: 19-Dec-2005 22:07:08   

So here I am thinking I've moved passed the problems I was having last week and all of the sudden I get this error..

An exception was caught during the execution of a retrieval query: The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Too many parameters were provided in this RPC request. The maximum is 2100.. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception

Yes, I'm passing in something like 2500 ids to a range predicate... certainly didn't expect that.. I'll be looking for a way around the problem, but would appreciate any help I could get from this wonderful forum. simple_smile

alexdresko
User
Posts: 336
Joined: 08-Jun-2004
# Posted on: 20-Dec-2005 00:00:39   

Eggzample..

         Dim standards As New EntityCollection(New StandardEntityFactory())
        Dim standardsFilter As New RelationPredicateBucket()

        Dim idList As New Generic.List(Of Integer)
        For i As Integer = 1 To 5000
            idList.Add(i)
        Next

        standardsFilter.PredicateExpression.Add(PredicateFactory.CompareRange(StandardFieldIndex.StandardId, idList))

        Dim adapter As New DataAccessAdapter()
        adapter.FetchEntityCollection(standards, standardsFilter)

Feel free to use your own entities for the example.

Answer
User
Posts: 363
Joined: 28-Jun-2004
# Posted on: 20-Dec-2005 00:47:54   

Its a database limitation as far as i know. The only way to get around it is to break up your persisting so your sending less parameters.

This is why the new datatableadapter in .NET 2.0 has a batch size, so you can prevent this from happening.

alexdresko
User
Posts: 336
Joined: 08-Jun-2004
# Posted on: 20-Dec-2005 01:09:59   

Answer wrote:

Its a database limitation as far as i know. The only way to get around it is to break up your persisting so your sending less parameters.

This is why the new datatableadapter in .NET 2.0 has a batch size, so you can prevent this from happening.

Thanks Answer! I have a work around plan... now let's just hope it doesn't backfire on me like this did.