473,796 Members | 2,460 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dealing with NULLs

Hi

I am building a very simple data entry system with many forms and
input textboxes.

When I leave any part of the form empty (it allows nulls) it seems to
touch the field in the DB and the field is no longer NULL.

I have written a script to test for empty textboxes and insert DB.NULL
which is fine but when I want to load the data back into the form
(i.e. NULL value into a textbox) it gives me an error.

Is it a bit overkill to replace 'no data' with DB.Nulls before
updating the DB and then do another test to test for DB.Nulls and
replace with empty string when retrieving the data from DB??
Nov 18 '05 #1
1 1292
The ToString method will return an empty string if the field is null (does a
check first but quite sure). This cehck should performed in your DB access
layer avoiding to do it again and again.

My personal preference is to avoid NULL if possible especially for
characters fields. This is not a problem as long as you don't have to
distinguish between a field that is an empty string and that holds NULL(for
example if a name is blank it's quite obvious the info is missing, for this
I use NOT NULL and uses a empty string).

For dates and numbers you don't have the same issue the number or date is
either "visible" or is a NULL value.

Patrice

--

"Angela" <an****@kaisen. co.uk> a écrit dans le message de
news:6f******** *************** ***@posting.goo gle.com...
Hi

I am building a very simple data entry system with many forms and
input textboxes.

When I leave any part of the form empty (it allows nulls) it seems to
touch the field in the DB and the field is no longer NULL.

I have written a script to test for empty textboxes and insert DB.NULL
which is fine but when I want to load the data back into the form
(i.e. NULL value into a textbox) it gives me an error.

Is it a bit overkill to replace 'no data' with DB.Nulls before
updating the DB and then do another test to test for DB.Nulls and
replace with empty string when retrieving the data from DB??

Nov 18 '05 #2

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

Similar topics

17
4245
by: Douglas Alan | last post by:
Is there a canonical way of iterating over the lines of a file that are null-separated rather than newline-separated? Sure, I can implement my own iterator using read() and split(), etc., but considering that using "find -print0" is so common, it seems like there should be a more cannonical way. |>oug
3
2014
by: aaj | last post by:
Hi I am probably going to regret asking this because I'm sure you are going to tell me my design is bad 8-) ah well we all have to learn.... anyway I often use Nulls as a marker to see if certain tasks have been completed. A typical example would be a column say invoice_value
2
1613
by: Lauren Quantrell | last post by:
I have a stored procedure as a recordsource from a contacts table. In this example, users can enter parameters to limit contacts by first letter of last name or company name or keywords: Example: @myName nvarchar(30) = null, @Alpha char(1) = null SELECT
0
1586
by: Rhino | last post by:
I am working with SQL Functions in DB2 for Windows/Linux/UNIX (V8.2.1) and am having a problem setting input parameters for SQL Functions to null in the Development Center. My simple function, called Half, has a single integer input parameter and divides this value by two to produce its result. It also tests the input parameter to see if it is null; if it is null, it returns null. When I click the Run button and try to use the SET TO...
1
2073
by: PST | last post by:
Here's a problem I'm trying to deal with: I'm working on a Frontpage 2000 website for a boat handicapping system, built in Access 97. What I'm trying to accomplish is: The user enters a boat name in a text field OR a sail number in a text field, and gets the desired boat record back (an exact match).
2
2535
by: rdshultz | last post by:
using access 2000. Have a form based on a couple of controls, it finds the last used Inquiry number in a table. So it finds the highest Inquiry number for the "Office" , "Company" and "YearStamp" selected by the user. Code below: =IIf(IsNull(DMax("","Inquiry"," = '" & ! & "' and" & " = '" & ! & "' and " & " = " & !)),0,DMax("","Inquiry"," = '" &
20
4060
by: Max Sandman | last post by:
I'm getting increasingly frustrated with C# and its exceptions on null values. Rather than try to deal with it on a hit-or-miss basis as exceptions pop up, I thought I should try to learn exactly how C# deals with null. Of course, there's nothing obvious in the docs like "Dealing with Null Values" and a search on "null" yielded 500 results, most of which don't apply. Can anybody point me in the right direction? Or offer some general...
12
2505
by: GaryDean | last post by:
Is there any good way in which to deal with null datetimes. For instance, I can't seem to find anything that will pass a null value in a datetime parameter to another method. Convert.dbnull will not work for instance. Getting nulls back and forth between C# and SQL Server is always problematic. -- Regards, Gary Blakely
5
2368
by: BXB | last post by:
I have a number in a table that starts off as currency. There are nulls in the data so I'm trying to convert the nulls to zeros and then wind up back in currency, or in fact in any numeric format. I've tried both of these. Add: Format(nz(,0),"Standard") Add: Format(nz(,0),"$#,##0.00") With this I wind up with what looks like numbers but when I export to Excel or try to subtotal at the bottom of the query I don't have numbers that...
0
9683
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9529
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10231
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10176
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10013
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9054
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5576
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4119
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3733
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.