Solved

OleDbCommand.ExecuteNonQuery

Posted on 2006-06-24
1
243 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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How do I hide MVVM menu items in WPF/XAML? 1 52
Please explain purpose of GZIP 4 82
How to escape alias names for Oracle query 1 40
array not updating 8 41
Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

739 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