Home All Groups Group Topic Archive Search About

Error during postback of web page related to SqlClient.SqlParamete

Author
23 Jun 2006 9:01 PM
masmith
I have a component in a ASP.NET 2.0 application trying to update a table in a
SQL 2005 database.  From the trace below the problem appears to be within a
internal methods in the framwork.

I have already found that the framework does not handle timestamps very
well, are there any other problems, datatypes or problems using Output
parameters in a stored procedure?

Does the "String[6]" relate to parameter 6 being passed?

Is there anything in this stack trace that can help me indentify or work
around the problem? --------------------------------------------------------------------------------
Stack Trace:
[InvalidOperationException: String[6]: the Size property has an invalid size
of 0.]
   System.Data.SqlClient.SqlParameter.Validate(Int32 index) +717075
   System.Data.SqlClient.SqlCommand.SetUpRPCParameters(_SqlRPC rpc, Int32
startCount, Boolean inSchema, SqlParameterCollection parameters) +97
   System.Data.SqlClient.SqlCommand.BuildRPC(Boolean inSchema,
SqlParameterCollection parameters, _SqlRPC& rpc) +81
   System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
+886
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method,
DbAsyncResult result) +132
   System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult
result, String methodName, Boolean sendToPipe) +415
   System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +135
   System.Web.UI.WebControls.SqlDataSourceView.ExecuteDbCommand(DbCommand
command, DataSourceOperation operation) +401
   System.Web.UI.WebControls.SqlDataSourceView.ExecuteInsert(IDictionary
values) +447
   System.Web.UI.DataSourceView.Insert(IDictionary values,
DataSourceViewOperationCallback callback) +72
   Infragistics.WebUI.UltraWebGrid.UltraWebGrid.InsertDBRow(UltraGridRow
row) +321
   Infragistics.WebUI.UltraWebGrid.UltraWebGrid.ProcessChanges(StateChanges
stateChanges, Boolean fireEvents) +28519
   Infragistics.WebUI.UltraWebGrid.UltraWebGrid.RaisePostDataChangedEvent()
+126
   System.Web.UI.Page.RaiseChangedEvents() +137
   System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4778 --------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET
Version:2.0.50727.42
--
Thanks,
Mark

Author
26 Jun 2006 6:12 AM
Carl Prothman
Mark,
If your Stored Procedure is returning just output parameters, then make sure to use ExecuteScalar() and not ExecuteNonQuery().

--

Thanks,
Carl Prothman
Microsoft ASP.NET MVP
http://www.CarlProthman.NET



Show quote
"masmith" <masm***@discussions.microsoft.com> wrote in message news:4E20647B-83EA-4427-A529-DA08D6DF2975@microsoft.com...
>I have a component in a ASP.NET 2.0 application trying to update a table in a
> SQL 2005 database.  From the trace below the problem appears to be within a
> internal methods in the framwork.
>
> I have already found that the framework does not handle timestamps very
> well, are there any other problems, datatypes or problems using Output
> parameters in a stored procedure?
>
> Does the "String[6]" relate to parameter 6 being passed?
>
> Is there anything in this stack trace that can help me indentify or work
> around the problem?
> --------------------------------------------------------------------------------
> Stack Trace:
> [InvalidOperationException: String[6]: the Size property has an invalid size
> of 0.]
>   System.Data.SqlClient.SqlParameter.Validate(Int32 index) +717075
>   System.Data.SqlClient.SqlCommand.SetUpRPCParameters(_SqlRPC rpc, Int32
> startCount, Boolean inSchema, SqlParameterCollection parameters) +97
>   System.Data.SqlClient.SqlCommand.BuildRPC(Boolean inSchema,
> SqlParameterCollection parameters, _SqlRPC& rpc) +81
>   System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior
> cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
> +886
>   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior
> cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method,
> DbAsyncResult result) +132
>   System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult
> result, String methodName, Boolean sendToPipe) +415
>   System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +135
Author
26 Jun 2006 1:12 PM
masmith
The stored procedure has InputOutput and Output only parameters.  The
component if from a third party vendor, so I have limited control over making
changes to it.

What I need to know is if this error is indeed occuring in the framework as
it appears to be in the stack trace?
Is the String[6] the same as the 6th or 7th paramenter being passed?
Is there any known problems with certain datatypes such as datetime or using
output parameters?
Is there a more appropriate news group to post these question?
--
Mark


Show quote
"Carl Prothman" wrote:

> Mark,
> If your Stored Procedure is returning just output parameters, then make sure to use ExecuteScalar() and not ExecuteNonQuery().
>
> --
>
> Thanks,
> Carl Prothman
> Microsoft ASP.NET MVP
> http://www.CarlProthman.NET
>

>
> "masmith" <masm***@discussions.microsoft.com> wrote in message news:4E20647B-83EA-4427-A529-DA08D6DF2975@microsoft.com...
> >I have a component in a ASP.NET 2.0 application trying to update a table in a
> > SQL 2005 database.  From the trace below the problem appears to be within a
> > internal methods in the framwork.
> >
> > I have already found that the framework does not handle timestamps very
> > well, are there any other problems, datatypes or problems using Output
> > parameters in a stored procedure?
> >
> > Does the "String[6]" relate to parameter 6 being passed?
> >
> > Is there anything in this stack trace that can help me indentify or work
> > around the problem?
> > --------------------------------------------------------------------------------
> > Stack Trace:
> > [InvalidOperationException: String[6]: the Size property has an invalid size
> > of 0.]
> >   System.Data.SqlClient.SqlParameter.Validate(Int32 index) +717075
> >   System.Data.SqlClient.SqlCommand.SetUpRPCParameters(_SqlRPC rpc, Int32
> > startCount, Boolean inSchema, SqlParameterCollection parameters) +97
> >   System.Data.SqlClient.SqlCommand.BuildRPC(Boolean inSchema,
> > SqlParameterCollection parameters, _SqlRPC& rpc) +81
> >   System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior
> > cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
> > +886
> >   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior
> > cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method,
> > DbAsyncResult result) +132
> >   System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult
> > result, String methodName, Boolean sendToPipe) +415
> >   System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +135
>
Author
26 Jun 2006 2:19 PM
Carl Prothman
"masmith" <masm***@discussions.microsoft.com> wrote
> The stored procedure has InputOutput and Output only parameters.  The
> component if from a third party vendor, so I have limited control over making
> changes to it.
>

Then you need to contact the third-party vendor and tell them they have a bug in their component.

If the SP does not return a result set and only had inputoutput/output parameters, then you must use ExecuteScalar() and not ExecuteNonQuery().


> What I need to know is if this error is indeed occurring in the framework as
> it appears to be in the stack trace?

I believe it's a bug in component's ADO.NET code.


> Is the String[6] the same as the 6th or 7th parameter being passed?

I believe it's zero based, so I'll say it's the 7th parameter.


> Is there any known problems with certain datatypes such as datetime or using
> output parameters?

None that I know of.


> Is there a more appropriate news group to post these question?

You could ask in the SQL Server group microsoft.public.sqlserver.programming but since you are using ADO.NET, I think this is the correct newsgroup.

--

Thanks,
Carl Prothman
Microsoft ASP.NET MVP
http://www.CarlProthman.NET
Author
27 Jun 2006 4:36 PM
masmith
I have determined the problem to be the SqlDataSource component.  For the
output varchar parameter it was not setting a value for "Size=50".  When you
manually change the SqlDataSource source the error no longer occurs.

--
Mark


Show quote
"Carl Prothman" wrote:

> "masmith" <masm***@discussions.microsoft.com> wrote
> > The stored procedure has InputOutput and Output only parameters.  The
> > component if from a third party vendor, so I have limited control over making
> > changes to it.
> >
>
> Then you need to contact the third-party vendor and tell them they have a bug in their component.
>
> If the SP does not return a result set and only had inputoutput/output parameters, then you must use ExecuteScalar() and not ExecuteNonQuery().
>
>
> > What I need to know is if this error is indeed occurring in the framework as
> > it appears to be in the stack trace?
>
> I believe it's a bug in component's ADO.NET code.
>
>
> > Is the String[6] the same as the 6th or 7th parameter being passed?
>
> I believe it's zero based, so I'll say it's the 7th parameter.
>
>
> > Is there any known problems with certain datatypes such as datetime or using
> > output parameters?
>
> None that I know of.
>
>
> > Is there a more appropriate news group to post these question?
>
> You could ask in the SQL Server group microsoft.public.sqlserver.programming but since you are using ADO.NET, I think this is the correct newsgroup.
>
> --
>
> Thanks,
> Carl Prothman
> Microsoft ASP.NET MVP
> http://www.CarlProthman

AddThis Social Bookmark Button