DeriveParameters throws NummReferenceException

R

rockdale.green

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
 
M

Mary Chipman [MSFT]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top