Solved

OleDbCommand.ExecuteNonQuery

Posted on 2006-06-24
1
246 Views
Last Modified: 2012-06-27

I'm getting an error ("String[1]:  the Size property has an invalid size of 0.") when executing the OleDbCommand.ExecuteNonQuery method.  The stored proc involved has 4 parameters, 2 input and 2 output.  I've executed the proc in isql and verified that it behaves.  I've stepped through the following C# code and verified the contents of the OleDbCommand object prior to the method call (the 4 parameters are in the right order, the output parms have the correct type, and the input parms have valid values).  Does anyone know what Size property is referred to in the error message?

            // Set output parameter types
            _oDbTypes = GetDbTypes();
            for (int i = 0; i < _oDbTypes.Length; i++)
            {
                OleDbParameter outParm = new OleDbParameter();
                outParm.Direction = ParameterDirection.Output;
                outParm.OleDbType = _oDbTypes[i];
                command.Parameters.Add(outParm);
            }

            // Set input parameter values
            for (int i = 0; i < _oInParmValues.Length; i++)
            {
                OleDbParameter inParm = new OleDbParameter();
                inParm.Value = _oInParmValues[i];
                command.Parameters.Add(inParm);
            }
            command.Connection = _conn;
            command.ExecuteNonQuery();

jkavx
0
Comment
Question by:jkavx
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 30

Accepted Solution

by:
Alexandre Simões earned 500 total points
ID: 16976841

Hi!
You never specify the parameter Size, that must be the problem.
For example, if the parameter's type is SqlType.Int, its size must be 4, numericPrecision 10 and a numeric scale 0 (zero).

Take a look at you r table an see each column properties, then set the right values to each one, your problem should desapear.

Alex :p
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question