Article View: borland.public.cppbuilder.database.ado
Article #948Re: TADOStoredProc DateTime SQL Field Null Value Setting Problem
From: Matt Jacobs
Date: Fri, 11 Feb 2005 10:55
Date: Fri, 11 Feb 2005 10:55
35 lines
1917 bytes
1917 bytes
"Fridgerator" <lmoss@srcpmw.com> wrote:
>
>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'
According to the help, this is one way:
Variant vNull;
vNull.ChangeType(varNull);
mADOStoredProc->Parameters->ParamByName("@DtConfirmed")->Value=vNull;
Also, how do you know the parameter is not set to NULL as expected?
Do you receive "1899/12/30" back from TField() or do you see that in
your database query tool?
Remember, if the column is NULL, TField() will give you back a date
value of zero, which will show as "1899/12/30".
Technical Details
Message-ID:
<4d3p01pfa02d0dand6tff7ub04d5t61bi2@4ax.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!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-7-bit From: Matt Jacobs <noyb@noyb.com> Newsgroups: borland.public.cppbuilder.database.ado Subject: Re: TADOStoredProc DateTime SQL Field Null Value Setting Problem Date: Fri, 11 Feb 2005 02:55:07 -0800 Reply-To: __noyb@noyb.com Message-ID: <4d3p01pfa02d0dand6tff7ub04d5t61bi2@4ax.com> References: <4207da7b$1@newsgroups.borland.com> X-Newsreader: Forte Agent 1.91/32.564 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 24.23.153.114 X-Trace: newsgroups.borland.com 1108119301 24.23.153.114 (11 Feb 2005 02:55:01 -0800) Lines: 36 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!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail