CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> General/Other

 Submitting '' instead of NULL for empty inputs

Print topic Send  topic

Author Message
reubgr

Posts: 1
Posted: 05/24/2006, 2:49 PM

Hi,

I need to save an empty string into certain fields and I can't seem to do that using the auto-generated grid. Empty fields get submitted as NULL causing the update to be rejected because the column does not allow NULLs.

Any ideas?

Thanks,
Reuben Grinberg
View profile  Send private message
peterr


Posts: 5971
Posted: 05/24/2006, 3:36 PM

I think that the Web browser doesn't submit such values and therefore they are null.
Though you can check if the value is null and change control values as described in the documentation: http://docs.codecharge.com/studio3/html/ProgrammingTech...ntrolValue.html
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
Edd


Posts: 547
Posted: 05/25/2006, 4:49 AM

Reuben,
I had a similar problem with a 3rd party product that would not accept nulls. There was only 2 ways around it:
1. Modify the Common file to allow for the blank lines - this then becomes global and to be honest - not recommended.
2. If your database supports stored procedures (as this did) then change your insert and updates to call custom stored procedures that perform inserts and updates. CCS will still pass nulls but the stored procedure can change that to blank inserts.


Edd
_________________
Accepting and instigating change are life's challenges.

http://www.syntech.com.au
View profile  Send private message
Reuben Grinberg
Posted: 05/25/2006, 6:19 AM

Peterr,
Thanks for the link. All the information on that page is about changing the values of the forms that are shown to the user. That is working fine now - the fields are blank. The problem is that when a blank field is submitted, it gets set as a NULL to the DB.

Edd,

I think the problem is in the Forms.cs file (I'm using C#). Currently, the SetValue function is:
public virtual void SetValue(object value,string format){
if(value == null) return;
if(value == null || value.Equals(DBNull.Value) || value.ToString() == "")
this.Value=null;
else

this.Value=(IComparable)value;
}

and hopefully changing it to the following will fix the problem:
public virtual void SetValue(object value,string format){
if(value == null) return;
if(value == null || value.Equals(DBNull.Value))
this.Value=null;
else
this.Value=(IComparable)value;
}
Reuben Grinberg
Posted: 05/25/2006, 8:20 AM

If anyone is interested, the answer is here: http://support.yessoftware.com/usrCaseResponses.asp?cas...berg@bwater.com
DonB
Posted: 05/28/2006, 6:02 PM

I'm wondering why you don't change the database column to allow NULLs, since
that is effectively what you are doing, except you make them 'empty string'
instead of an explicit null. From a database designer point-of-view this is
a horrible thing to do.

--
DonB

http://www.gotodon.com/ccbth


"reubgr" <reubgr@forum.codecharge> wrote in message
news:24474d4f065311@news.codecharge.com...
> Hi,
>
> I need to save an empty string into certain fields and I can't seem to do
that
> using the auto-generated grid. Empty fields get submitted as NULL causing
the
> update to be rejected because the column does not allow NULLs.
>
> Any ideas?
>
> Thanks,
> Reuben Grinberg
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>


Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.