Hi,

I am coding under .Net compact framework and using
System.Data.SqlClient connect to MS SQL server through PDA USB cradle.
I can execute stored procedures and sql select or updates statements.
But I always get NullreferenceException when I try to use
DeriveParameters function of SQLCommand to get parameters of my stored
procedure? Any idea?
I tried the same function under .Net framework, it works fine.

I am using SQLHelper the function is
DiscoverSpParameterSet(SqlConnection connection, string spName, bool
includeReturnValueParameter)

And I got exception on this line

SqlCommandBuilder.DeriveParameters(cmd);

Anybody has experienced this before. Is it a bug for .NET CF(cannot use
DeriveParameters function)? Do I have to explicit assign those
parameters for my stored procedures (that would be a painful coding)

thanks in advance
-rockdale

Re: DeriveParameters throws NummReferenceException by Mary

Mary
Mon Sep 04 12:45:53 CDT 2006

I'm not sure why it's not working, but unless you don't care about
performance, you might want to just code them in. DeriveParameters
requires a separate round trip to the server, which goes a long way
towards negating the performance advantages of writing stored
procedures to begin with. You can get more information at
http://msdn2.microsoft.com/en-us/library/yy6y35y8.aspx or in the
online help topic for SqlCommandBuilder.DeriveParameters.

--Mary

On 23 Aug 2006 11:52:16 -0700, rockdale.green@gmail.com wrote:

>Hi,
>
>I am coding under .Net compact framework and using
>System.Data.SqlClient connect to MS SQL server through PDA USB cradle.
>I can execute stored procedures and sql select or updates statements.
>But I always get NullreferenceException when I try to use
>DeriveParameters function of SQLCommand to get parameters of my stored
>procedure? Any idea?
>I tried the same function under .Net framework, it works fine.
>
>I am using SQLHelper the function is
>DiscoverSpParameterSet(SqlConnection connection, string spName, bool
>includeReturnValueParameter)
>
>And I got exception on this line
>
>SqlCommandBuilder.DeriveParameters(cmd);
>
>Anybody has experienced this before. Is it a bug for .NET CF(cannot use
>DeriveParameters function)? Do I have to explicit assign those
>parameters for my stored procedures (that would be a painful coding)
>
>thanks in advance
>-rockdale