Re: Treating NULL database values in classes and Form fields.

Tech-Archive recommends: Fix windows errors by optimizing your registry



Thanks for the response, Cor. As expected there were a number suggestions,
all of them equally valid. Plenty to think about.

Regards,

Gordon.


"Cor Ligthert[MVP]" wrote:

YaHozna,

In my idea is this question valid for every way of programming. It is in
fact a question how to handle the can be zero Null addition to a column type
in SQL.

It has been forever confusing. A Null in SQL means in fact unused. It is up
to you what you make from that. Mostly is that for a numeric field simple
zeros.

However in most cases a simple null wil work the most simple.

In VB8 you can use nullable fields, but for me is this a kind of creating it
confirm C type languages. A blob field makes probably sense to avoid that
filled with rubish in a database. A null value field is in my perception a
kind of micro optimizing from 1970 or maybe 1980 but not from this
millenium.

This is a longtime problem and longwhile users have asked to do something
about that problem. In SQL Server 2008 is beside the possibilitie to
declare a column as can be Null column, the possibility to declare a column
as a can be "Empty" column.

Cor

"YaHozna" <YaHozna@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:49CE30C7-D97D-4C3E-A9E4-61FA6D844682@xxxxxxxxxxxxxxxx
Been wondering about this one for a while so I thought I'd see what other
people do about it.

When I read numeric data from a database into a class object and then
display the data on a Form what are the different ways out there for
dealing
with values that are NULL in the database? Let me explain.

I may have a number of numeric values in my database that are currently
NULL
- i.e. not every value has been supplied by the user. When they are read
into
my application the associated Form fields should then display nothing
rather
than zeroes. However when these values are read into a class object what
should they be stored as? They can't be stored as DBNulls assuming I am
using
numeric class property values. In the past where a value in the database
is
NULL I have set the associated property value to -1. I can then set Form
fields associated with property values that are -1 to blank. Alternatively
I
can use Object property values which means I can set them to DBNull for
associated database values that are NULL. Neither of these are
particularly
satisfactory.

What are my other options here?

Regards,

Gordon.


.



Relevant Pages

  • Re: CREATE AGGREGATE failed because type Concatenate does not conform to UDAGG specification due to
    ... Go to the Database tab and click on the browse button next to the connection string. ... In the New Database Reference dialog, enter the details for the database where you want to deploy the assembly and create the user defined aggregate. ... I'm trying to do some CLR integration with sql server 2005. ...
    (microsoft.public.sqlserver.programming)
  • CREATE AGGREGATE failed because type Concatenate does not conform to UDAGG specification due to meth
    ... Now register the assembly and the aggregate in the SQL Server database you want ... I'm trying to do some CLR integration with sql server 2005. ...
    (microsoft.public.sqlserver.programming)
  • Re: dbdebunk Quote of Week comment
    ... > a lot of really bad SQL programmers. ... But SQL does not have a pointer data type or the ... > being told to design a database. ... But why is little Cindy Lou Who employee ...
    (comp.databases.theory)
  • Re: Querying a DataSet/DataTable in .NET
    ... to writing an in-memory database engine. ... >>>I think it would be nice if we could have a SQL engine available on the ... >>> display only (I could put it in business objects so I can reuse the ...
    (microsoft.public.dotnet.general)
  • Re: DBMS and lisp, etc.
    ... Naively implemented with SQL, again for 10 ... (1 query for the initial orders, 1 query for each order for its ... soon as you upgrade to the SQL database. ... (eq (order-customer orderA) ...
    (comp.lang.lisp)