🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Problem still Occurring - Any ideas?

#982
From: Jochen Reichenberg
Date: Tue, 22 Feb 2005 08:50
131 lines
5229 bytes
I might be wrong, but AFAIK NULL in a database does not mean 0. NULL means
there is literally no value. 0 means the value is zero.
You will get different results if you filter a table for NULL or 0!

Joe


"Viatcheslav V. Vassiliev" <support@oledbdirect.com> schrieb im Newsbeitrag
news:42093573@newsgroups.borland.com...
> 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: <421af267@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
References: <4207da7b$1@newsgroups.borland.com> <4207dc0e@newsgroups.borland.com> <4208f0a4$1@newsgroups.borland.com> <4208fef3$1@newsgroups.borland.com> <42093573@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: "Jochen Reichenberg" <jochen@jreichenberg.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> <42093573@newsgroups.borland.com>
Subject: Re: Problem still Occurring - Any ideas?
Date: Tue, 22 Feb 2005 09:50:50 +0100
Lines: 133
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
NNTP-Posting-Host: 80.133.116.40
Message-ID: <421af267@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1109062247 80.133.116.40 (22 Feb 2005 00:50:47 -0800)
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