Article View: borland.public.cppbuilder.database.ado
Article #4354Re: Field length problem
From: Gary Desroches
Date: Mon, 14 Jan 2002 03:02
Date: Mon, 14 Jan 2002 03:02
45 lines
2407 bytes
2407 bytes
Um, Did you forget that you must allow an extra space for the end of string
character?
if you need 5 characters for the data you must have a size of 6 for a null
terminated
string or 7 ( I think ) for a "/r" terminated string.
"Builder" <JohnnyHor@hotmail.com> wrote in message news:3c40e850_1@dnews...
> Hello all.
>
> I'm trying to insert values into an Access 2002 table. Lets assume that
I
> have only one field in the table and call it date
> (represents date in the format mm/yy). My problem is that when I try to
set
> the field's value to a 5 chars value it doesn't do it. If i try to set it
to
> a 4 or less char value everything is ok. What's the problem?
> The field is declared as follows ( In access):
> Field Size: 5
> Required : No
> Allow Zero Length: Yes
> Index: No
> Unicode compr Yes
> The rest are blank
>
> Here's my code ( Importing ActiveX Data Objects v2.5 in BCB 4):
>
> TCOM_Recordset rs = CoRecordset::Create();
> rs->Open("mytable","DSNName",adOpenDynamic,
> adLockOptimistic,adCmdTable);
> rs->AddNew();
> // This field will stay blank
> rs->Fields_->get_Item("Date")->set_Value("01/01");
> // This field will contain 01/0
> rs->Fields_->get_Item("Date")->set_Value("01/0");
> rs->Update();
> delete rs;
>
> What may be the problem?
> Thank you
> Builder
>
>
>
>
Technical Details
Message-ID:
<a1thvd$9p2$1@slb7.atl.mindspring.net>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed1.earthlink.net!newsfeed2.earthlink.net!newsfeed.earthlink.net!news.mindspring.net!not-for-mailReferences:
<3c40e850_1@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,746c62554cb2af80 X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2002-01-13 19:07:06 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed1.earthlink.net!newsfeed2.earthlink.net!newsfeed.earthlink.net!news.mindspring.net!not-for-mail From: "Gary Desroches" <gcdesroches@mindspring.com> Newsgroups: borland.public.cppbuilder.database.ado Subject: Re: Field length problem Date: Sun, 13 Jan 2002 21:02:34 -0600 Organization: MindSpring Enterprises Lines: 47 Message-ID: <a1thvd$9p2$1@slb7.atl.mindspring.net> References: <3c40e850_1@dnews> Reply-To: "Gary Desroches" <gcdesroches@mindspring.com> NNTP-Posting-Host: d1.56.31.20 X-Server-Date: 14 Jan 2002 03:06:21 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200