The incoming request has too many parameters. The server supports a maximum of 2100 parameters

后端 未结 6 1143
野性不改
野性不改 2020-12-16 10:33

I have this seemingly simple linq-to-sql query that searches some data in several columns; something like this:

List TheTableIDs = list of IDs (s         


        
6条回答
  •  星月不相逢
    2020-12-16 11:28

    I was getting this and was I no way using 2100 parameters! Something else was afoot.

    On closer examination I found that I was adding supposedly 5 parameters in a loop, but the source object was not getting cleared, so the list of object to insert was just getting bigger and bigger.

     Dim reportNum = 1
    
                    For Each report In wwo.wwoWeatherReport.listOfForecasts
                        'whack these into the  regionsAndCountries
                        db.addParameter("@forecastAirTemp" & reportNum, report.listOfhourlyForecasts(0).hourlyForecast_tempC)
                        db.addParameter("@forecastRainFall" & reportNum, report.listOfhourlyForecasts(0).hourlyForecast_precipMM)
                        reportNum = reportNum + 1
    
                    Next
    

    I had to Dim a new wwo object beforehand and it sorted it

    Dim wwo As New wwwoManager
    
    Dim reportNum = 1  ...
    

提交回复
热议问题