PC Review


Reply
Thread Tools Rate Thread

Copying over null values in DB

 
 
mavrick_101
Guest
Posts: n/a
 
      4th May 2010
Hi,

I'm saving data entered by a user. If the user does not enter a value in the
field I would like to insert null value. I want to do this so that I don't
have to write a seperate query for each column and various columns may be
left blank by the user. Instead of entering a blank space I want to enter
null (the columns in the db are nullable).

How can I do that?

Thanks.
 
Reply With Quote
 
 
 
 
Mark Rae [MVP]
Guest
Posts: n/a
 
      4th May 2010
"mavrick_101" <(E-Mail Removed)> wrote in message
news:9DE76512-1C74-4D71-9CC3-(E-Mail Removed)...

> How can I do that?


Firstly, you'll need to provide more information. Specifically:

1) which database are you using?
2) how are you connecting to it?


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

 
Reply With Quote
 
Harlan Messinger
Guest
Posts: n/a
 
      5th May 2010
mavrick_101 wrote:
> Hi,
>
> I'm saving data entered by a user. If the user does not enter a value in the
> field I would like to insert null value. I want to do this so that I don't
> have to write a seperate query for each column and various columns may be
> left blank by the user. Instead of entering a blank space I want to enter
> null (the columns in the db are nullable).
>
> How can I do that?
>
> Thanks.


insert into T (id, name, comment) VALUES (5085, 'John Jones', null)
 
Reply With Quote
 
Andrew Morton
Guest
Posts: n/a
 
      5th May 2010
mavrick_101 wrote:
> I'm saving data entered by a user. If the user does not enter a value
> in the field I would like to insert null value. I want to do this so
> that I don't have to write a seperate query for each column and
> various columns may be left blank by the user. Instead of entering a
> blank space I want to enter null (the columns in the db are nullable).
>
> How can I do that?


You can pass DbNull.Value as the value of a parameter to get a null in the
database.

--
Andrew


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Display queried records with Null values (null recordcount) Mishanya Microsoft Access Getting Started 6 25th Jan 2009 06:53 PM
Null or No Null values in a parameter query tim Microsoft Access Getting Started 6 13th Aug 2008 10:43 PM
Empty text values aren't null or zero-length, but 2-byte null (\x0000) Mark Steward Microsoft Access 2 21st Jan 2006 02:03 PM
Error msg not accepting null value when there are no null values =?Utf-8?B?c3RldmVtYW4yMDAw?= Microsoft Access 2 13th Jul 2005 12:32 PM
In Crosstab Query If Any Values Are Null I Want Sum to Be Null mcl Microsoft Access Queries 4 27th Feb 2004 06:26 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:27 AM.