Article View: borland.public.cppbuilder.database.ado
Article #945Problem still Occurring - Any ideas?
From: Fridgerator
Date: Tue, 08 Feb 2005 18:03
Date: Tue, 08 Feb 2005 18:03
79 lines
3620 bytes
3620 bytes
I have also tried to assign the OleVariant(VT_NULL) in the CreateParameter call. This compiles fine but I get the same
result when running the stored proc. It executes but the date
that is written to the table is '1899-12-31 00:00:00.000' not
NULL.
If anyone has any other ways ideas I would appreciate hearing
them.
Leonard Moss
"Fridgerator" <lmoss@srcpmw.com> wrote:
>
>I must be missing something but OleVariant(VT_NULL) is not assignable to:
>
>mADOStoredProc->Parameters->ParamByName("@DtConfirmed")->Value
>
>I'm assuming that is what you meant by your reply. Does the parameter need to be defined as DateTime or String or some other type in order for this to occur. I tried Variant(VT_NULL) but this gave the same erroneous results for the date.
>
>Leonard Moss
>
>"Viatcheslav V. Vassiliev" <support@oledbdirect.com> wrote:
>>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:
<4208fef3$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!zen.net.uk!dedekind.zen.co.uk!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<4207da7b$1@newsgroups.borland.com> <4207dc0e@newsgroups.borland.com> <4208f0a4$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: "Fridgerator" <lmoss@srcpmw.com> Sender: "Fridgerator" <lmoss@srcpmw.com> Reply-To: "Fridgerator" <lmoss@srcpmw.com> Subject: Problem still Occurring - Any ideas? Newsgroups: borland.public.cppbuilder.database.ado X-User-Info: 205.169.209.234 References: <4207da7b$1@newsgroups.borland.com> <4207dc0e@newsgroups.borland.com> <4208f0a4$1@newsgroups.borland.com> NNTP-Posting-Host: 207.105.83.66 Message-ID: <4208fef3$1@newsgroups.borland.com> Date: 8 Feb 2005 10:03:31 -0800 X-Trace: newsgroups.borland.com 1107885811 207.105.83.66 (8 Feb 2005 10:03:31 -0800) Lines: 80 Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!zen.net.uk!dedekind.zen.co.uk!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail