Geeks With Blogs

News My Blog has been MOVED to https://mfreidge.wordpress.com
Michael Freidgeim's OLD Blog My Blog has been MOVED to https://mfreidge.wordpress.com

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 on Wednesday, June 20, 2007 12:45 AM .Net Framework | Back to top


Comments on this post: Workaround "The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect" error.

# re: Workaround "The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect" error.
Requesting Gravatar...
Thanks for det workaround, worked perfectly...
Left by Mads Neve on Jan 13, 2009 10:52 PM

# re: Workaround "The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect" error.
Requesting Gravatar...
When you use SqlDbType.Decimal instead of DbType.Decimal the problem is also solved, with less impact.
Left by Duvadesa on Mar 18, 2009 7:55 PM

# re: Workaround "The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect" error.
Requesting Gravatar...
Is it possible to solve that by doing something in the database not in the code?
Left by Felipe on Dec 17, 2010 5:32 AM

Your comment:
 (will show your gravatar)


Copyright © Michael Freidgeim | Powered by: GeeksWithBlogs.net