Wednesday, March 28, 2012

Parameter name getting garbled

I have a function that calls a sproc, and passes in a bunch of parameters. One of the parameters is named @.ProcessorEmail. Occasionally, the parameter name apparently gets garbled at runtime, as the following error occurs:

System.Data.SqlClient.SqlException: @.ProcessorEm??. is not a parameter for procedure gUser

The "@.ProcessorEm" part is always fine, then there will be various characters in place of the "ail" part.

Any ideas?Does your code hardcode the params or are they been fetched/constructed?|||They are hardcoded. The rest of the params are fine, it is always this same parameter that gets messed up. Again, it does not happen every time, just occasionally.|||Does the data your sending in the param contain any control codes or slighly odd unicode (i.e. taking data from a non .net source)?|||Actually, the parameter in question is being passed as an output parameter, so it does not have a value when I am passing it.|||What data is returned from the proc? Is it only outputs or a combination of outputs and record-sets?|||A combination of outputs. The sproc accepts a single input sproc, then the rest of the params are output params, with only a single record being returned. The param being passed in is an email address, which is the primary key constraint in the table, so there should be no dupes.|||Do you ensure that you've processed *every* row of the record set before you attempt to access the output params?|||Sorry, I misspoke. It is only output parameters, no recordsets.|||Odd one, are you sharing the command object or creating a fresh one each time?|||It's new on each instantiation. The command resides in a class I created called User. There are two constructors for User, one accepts the userid, the other accepts the email address. The only way to run the sproc is to create a new User object in my code.

Dim mUser as New User("me@.domain.com")

No comments:

Post a Comment