🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Problem still Occurring - Any ideas?

#946
From: Viatcheslav V. Vassiliev
Date: Tue, 08 Feb 2005 21:56
109 lines
4578 bytes
I mean type of OleVariant, not its value:

 OleVariant Null;
 Null.VType  = VT_NULL;

->ParamByName("...")->Value = Null;

Null should be defined in Variants unit (Variants.hpp) in C++ Builder 6 or 
somewhere else in C++ Builder 5. Note that Null is not the same as NULL. 
Anyway, try code above.

//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 + 
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)

"Fridgerator" <lmoss@srcpmw.com> �������/�������� � �������� ���������: 
news:4208fef3$1@newsgroups.borland.com...
>
> 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: <42093573@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!fr.ip.ndsoftware.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4207da7b$1@newsgroups.borland.com> <4207dc0e@newsgroups.borland.com> <4208f0a4$1@newsgroups.borland.com> <4208fef3$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> <4207dc0e@newsgroups.borland.com> <4208f0a4$1@newsgroups.borland.com> <4208fef3$1@newsgroups.borland.com>
Subject: Re: Problem still Occurring - Any ideas?
Date: Wed, 9 Feb 2005 00:56:02 +0300
Lines: 111
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.237
Message-ID: <42093573@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1107899763 85.93.136.237 (8 Feb 2005 13:56:03 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!fr.ip.ndsoftware.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail