Workaround "The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect" error.

We have a .Net 1.1 application that worked with SQL server 2000. When we changed it to work with sql Server 2005, some calls to SPs returned errors like the following

"The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 8 ("@ParamName"): The supplied value is not a valid instance of data type numeric. Check the source data for invalid values. An example of an invalid value is data of numeric type with scale greater than precision."

It was found, that C# decimal variable can keep values with more than 4 decimal points (e.g. 43.23232322323) and when it is passes to SP parameter as MONEY, combination .Net 1.1 - SQL Server 2005 doesn't work.
Note that combination  .Net 1.1 - SQL Server 2000 and  .Net 2.0 - SQL Server 2005  work fine.

To workaround I've added simple function to round values before assigning SP parameter

       public static decimal SafeMoney(object attribute)
        {
            decimal decMoney = Convert.ToDecimal(attribute);
            decMoney = Math.Round(decMoney, 4);//required in 1.1 to connect to SQL Server 2005
           return decMoney;
        }

 

 

posted @ Wednesday, June 20, 2007 12:45 AM

Print

Comments on this entry:

# re: Workaround "The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect" error.

Left by Mads Neve at 1/13/2009 10:52 PM
Gravatar
Thanks for det workaround, worked perfectly...

# re: Workaround "The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect" error.

Left by Duvadesa at 3/18/2009 7:55 PM
Gravatar
When you use SqlDbType.Decimal instead of DbType.Decimal the problem is also solved, with less impact.

Your comment:



 (will not be displayed)


 
 
 
 
 

Live Comment Preview:

 
«November»
SunMonTueWedThuFriSat
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345