PC Review Forums Newsgroups Microsoft DotNet Microsoft ADO .NET Error during postback of web page related to SqlClient.SqlParamete

Reply

Error during postback of web page related to SqlClient.SqlParamete

 
Thread Tools Rate Thread
Old 23-06-2006, 10:01 PM   #1
=?Utf-8?B?bWFzbWl0aA==?=
Guest
 
Posts: n/a
Default Error during postback of web page related to SqlClient.SqlParamete


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
  Reply With Quote
Old 26-06-2006, 02:12 PM   #2
=?Utf-8?B?bWFzbWl0aA==?=
Guest
 
Posts: n/a
Default Re: Error during postback of web page related to SqlClient.SqlPara

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


"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" <masmith@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

>

  Reply With Quote
Old 27-06-2006, 05:36 PM   #3
=?Utf-8?B?bWFzbWl0aA==?=
Guest
 
Posts: n/a
Default Re: Error during postback of web page related to SqlClient.SqlPara

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


"Carl Prothman" wrote:

> "masmith" <masmith@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

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off