473,378 Members | 1,549 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

"No size set for variable length data" Oracle update error with empty string in .NET

Hi - I'm updating an Oracle table with an empty string and getting the
error:

An unhandled exception of type 'System.Exception' occurred in
system.data.dll
Additional information: Parameter 'p1': No size set for variable length data
type: String.

The column is nullable and of type varchar2(50). I'm aware that I can store
DBNull.Value instead and Oracle won't complain, but, I was hoping to avoid
testing and converting for that condition. It seems the .NET class lib
should handle empty strings, no? There are times I'd like to throw the
dataset into a datagrid control and have the user have there way with it,
therefore, its not ideal to have to validate each string value on the
update.

Question 1: Is this a bug or am I doing something wrong?
Question 2: If its a bug, is there an elegant workaround?
Sample C# code is:

// create typed dataset (basic customer list: name, address, phone, etc.)
CustomerDS dsCustomer = new CustomerDS();

// create data adapter
OracleDataAdapter daCustomers = new OracleDataAdapter("SELECT * FROM
Customers", connectionString);

// use command builder to create update, insert and delete commands based on
select
OracleCommandBuilder cb = new OracleCommandBuilder(daCustomers);

// get some data
daCustomers.Fill(dsCustomer.CUSTOMERS)

// delete Middle Name, for example
dsCustomer.CUSTOMERS.Rows[0]["MIDDLE_NAME"] = "";

// store new dataset
daCustomers.Update(dsCustomer, "Customers");

// boom - get error (even though I put it in a try...catch block!)
Jul 19 '05 #1
1 14911
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

arvee wrote:
Hi - I'm updating an Oracle table with an empty string and getting the
error:

An unhandled exception of type 'System.Exception' occurred in
system.data.dll
Additional information: Parameter 'p1': No size set for variable length data
type: String.

The column is nullable and of type varchar2(50). I'm aware that I can store
DBNull.Value instead and Oracle won't complain, but, I was hoping to avoid
testing and converting for that condition. It seems the .NET class lib
should handle empty strings, no? There are times I'd like to throw the
dataset into a datagrid control and have the user have there way with it,
therefore, its not ideal to have to validate each string value on the
update.

Question 1: Is this a bug or am I doing something wrong?
Question 2: If its a bug, is there an elegant workaround?

[snip!]
Why don't you store a NULL? Oracle will treat '' (empty string) as
NULL, and store as NULL anyway - better be prepared for it, and
treat it as such.

Oh yes - it will work when you let Oracle do the conversion(s), but
some understanding of the product you are working with will only
help you in creating a better product.

All documentation is on docs.oracle.com - free! Start with Concepts.

- --
Regards,
Frank van Bortel
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCVm8QfyJ9XXMPY5URArK8AKCRsSGLCWO9VYv3YnUqLc X2rYE1DACfTcCO
f8j04ChsvUGatK4rAjP0wzY=
=nBQ1
-----END PGP SIGNATURE-----
Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: 21novembre | last post by:
Hi all, I made a question several days before to describe my strange trouble of mysqldump. But I still can't figour it out. Well, I just want to ask another question whether I could just backup...
134
by: James A. Donald | last post by:
I am contemplating getting into Python, which is used by engineers I admire - google and Bram Cohen, but was horrified to read "no variable or argument declarations are necessary." Surely that...
3
by: Jimski | last post by:
Hello all, I am having a problem where I get an error message when I call FlushFinalBlock when decrypting my encrypted text. I am using the Rijndael algorithm. The error message is "Length...
7
by: Dica | last post by:
i've used the sample code from msdn to create an encyption/decryption assembly as found here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetHT10.asp i'm...
2
by: holysmokes99 | last post by:
I am developing a component in .Net 1.1, and want to debug it using the "start external program" of the debugger in the IDE. The program I want to start references both 1.1 and 2.0 components. The...
21
by: comp.lang.tcl | last post by:
set php {<? print_r("Hello World"); ?>} puts $php; # PRINTS OUT <? print_r("Hello World"); ?> puts When I try this within TCL I get the following error:
4
by: vunet.us | last post by:
Hi all, I am converting my app to AJAX-based. I have a form that submits some data including images. When I use AJAX XmlHttpRequest I am unable to submit the form with...
2
by: jj555s | last post by:
I get a Message that says "No error occured." when I tried to write in a file. What does it mean?
2
bugboy
by: bugboy | last post by:
Hi i'm a beginner at php and my simple web query page doesn't work.. i swear i had it working at one point but now i've come back to it it doesn't. My form works My DB connection works ...
1
by: chrisj | last post by:
I'm using freeASPupload and got some assistance integrating to a Member script. It works successfully. In this modified version there are two groups that use this upload script. Members of one...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.