🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #942

TADOStoredProc DateTime SQL Field Null Value Setting Problem

#942
From: Fridgerator
Date: Mon, 07 Feb 2005 21:15
37 lines
2226 bytes
Environment:

C++ Builder 6
MS SQL Server
Table Column allows null.

Using TADOStoredProc

I create a parameter:

mADOStoredProc->Parameters->CreateParameter("@DtConfirmed", ftDateTime, pdInput, 8, NULL);

I assign a NULL value

mADOStoredProc->Parameters->ParamByName("@DtConfirmed")->Value = NULL;

When I execute the stored procedure it is successful.  The problem lies in the fact that the field I want to be NULL now contains a default date.
'1899/12/30'

If I change the above create parameter statement to:

mADOStoredProc->Parameters->CreateParameter("@DtConfirmed", ftString, pdInput, 50, NULL);

and assign it to:

mADOStoredProc->Parameters->ParamByName("@DtConfirmed")->Value = "";

Execute the stored proc the value for this field is now the sql default date:
'1900/01/01'

What I really want is for this parameter to set to NULL in the table.  Is there anyway to pass this via a stored procedure parameter so that the value in the table is NULL.  I have tried varied attemps to pass NULL and other things but short of modifying the stored proc to look to see if the value is some default date and explicitly writing setting the field to NULL I cannot figure out how this can be done programtically.

Any help would be appreciated.

Leonard Moss
lmoss@srcpmw.com
Technical Details
Message-ID: <4207da7b$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!feeder2.on.meganewsservers.com!meganewsservers.com!textfeed1.on.meganewsservers.com!38.119.100.83.MISMATCH!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,c5cad520fb3a6714,start
X-Google-Attributes: gid10698b,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Fridgerator" <lmoss@srcpmw.com>
Sender: "Fridgerator" <lmoss@srcpmw.com>
Reply-To: "Fridgerator" <lmoss@srcpmw.com>
Subject: TADOStoredProc DateTime SQL Field Null Value Setting Problem
Newsgroups: borland.public.cppbuilder.database.ado
X-User-Info: 205.169.209.234     
NNTP-Posting-Host: 207.105.83.66
Message-ID: <4207da7b$1@newsgroups.borland.com>
Date: 7 Feb 2005 13:15:39 -0800
X-Trace: newsgroups.borland.com 1107810939 207.105.83.66 (7 Feb 2005 13:15:39 -0800)
Lines: 39
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!feeder2.on.meganewsservers.com!meganewsservers.com!textfeed1.on.meganewsservers.com!38.119.100.83.MISMATCH!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail