inserting null into DB

inserting null into DB

am 03.01.2007 13:02:58 von talk2raj55

hi

I am encountering a problem as follows:
I have a text box called fax no on the form,
its stored into the dbase as numeric data field
now the problem is that i can't insert a null value
into the numeric field,
(that is in the absence of fax no)
What can i do in such a case???
I need to insert null into the DB, if fax no is not provided
instead of stopping the whole insert query.

Re: inserting null into DB

am 03.01.2007 13:15:51 von reb01501

talk2raj55@gmail.com wrote:
> hi
>
> I am encountering a problem as follows:
> I have a text box called fax no on the form,
> its stored into the dbase as numeric data field
> now the problem is that i can't insert a null value
> into the numeric field,
> (that is in the absence of fax no)
> What can i do in such a case???
> I need to insert null into the DB, if fax no is not provided
> instead of stopping the whole insert query.

The answer depends on:
1. database type and version
2. the method you are using to insert the data - show us a code snippet


--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Re: inserting null into DB

am 03.01.2007 20:45:32 von mmcginty

wrote in message
news:1167825778.466742.303980@h40g2000cwb.googlegroups.com.. .
> hi
>
> I am encountering a problem as follows:
> I have a text box called fax no on the form,
> its stored into the dbase as numeric data field
> now the problem is that i can't insert a null value
> into the numeric field,
> (that is in the absence of fax no)
> What can i do in such a case???
> I need to insert null into the DB, if fax no is not provided
> instead of stopping the whole insert query.

If you're using VBS, un-entered form fields will be an empty string, not
null. An empty string is always illegal for numeric fields, you'd have to
convert to null.

Also, there's nothing inherent to numeric fields that rules-out NULL;
whether or not the field will accept NULL is a settable property of that
field.

Lastly, phone numbers are typically stored as text, rather than numbers,
because of common output formatting goals (which will necessitate conversion
to text) and the fact that there are usually no math ops that make sense
with a phone number.


-Mark

Re: inserting null into DB

am 04.01.2007 04:56:55 von talk2raj55

Thanks a lot for the reply.
this should help me, further.