Error during postback of web page related to SqlClient.SqlParamete

G

Guest

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
 
G

Guest

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 said:
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 said:
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
 
G

Guest

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 said:
masmith said:
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
 

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