Article View: borland.public.cppbuilder.database.ado
Article #943Re: TADOStoredProc DateTime SQL Field Null Value Setting Problem
From: Viatcheslav V. Vassiliev
Date: Mon, 07 Feb 2005 21:22
Date: Mon, 07 Feb 2005 21:22
54 lines
2696 bytes
2696 bytes
NULL is integer with value 0 in C++. You should set OleVariant with type
VT_NULL.
"Fridgerator" <lmoss@srcpmw.com> �������/�������� � �������� ���������:
news:4207da7b$1@newsgroups.borland.com...
>
> 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:
<4207dc0e@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!news.moat.net!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!news-in.nuthinbutnews.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<4207da7b$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,c5cad520fb3a6714 X-Google-Attributes: gid10698b,public X-Google-Language: ENGLISH,ASCII From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com> Newsgroups: borland.public.cppbuilder.database.ado References: <4207da7b$1@newsgroups.borland.com> Subject: Re: TADOStoredProc DateTime SQL Field Null Value Setting Problem Date: Tue, 8 Feb 2005 00:22:22 +0300 Lines: 56 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2527 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 85.93.136.236 Message-ID: <4207dc0e@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1107811342 85.93.136.236 (7 Feb 2005 13:22:22 -0800) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!news.moat.net!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!news-in.nuthinbutnews.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail