Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 1 to 10 of 14 total |
How do you all access byte fields? |
Thu, Aug 16 2012 8:13 PM | Permanent Link |
Dominique Willems | A truly humongously stupid question, I am sure, but I am curious as to
how you access your one-byte fields? I have tried to use AsString, but it returns empty. AsInteger, the obvious choice, gives me "cannot access field as type integer." I'm sure there is a really really simple solution, so I'm looking forward to the answer. Cheers! |
Sun, Aug 19 2012 1:07 AM | Permanent Link |
Barry | Dominique,
How did you put the data into the byte fields? Barry |
Sun, Aug 19 2012 10:30 AM | Permanent Link |
Malcolm Taylor | Dominique Willems wrote:
> A truly humongously stupid question, I am sure, but I am curious as to > how you access your one-byte fields? > > I have tried to use AsString, but it returns empty. AsInteger, the > obvious choice, gives me "cannot access field as type integer." > > I'm sure there is a really really simple solution, so I'm looking > forward to the answer. Cheers! Hmm, I don't have such types but have you tried .AsBytes ? |
Sun, Aug 19 2012 11:16 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Dominique
What datatype are you using to create the column in the table? One problem will probably be that some types either don't match well to their potential Delphi equivalent of just don't match. I just created a 1 Byte column - what you have to do is procedure TForm1.Button1Click(Sender: TObject); var xx:string; yy:integer; begin xx:=test.fieldbyname('_bytes').asstring; yy:=ord(xx[1]); showmessage(inttostr(yy)); end; In my case I'd shoved 05 into it in EDBManager Roy Lambert |
Mon, Aug 20 2012 7:49 AM | Permanent Link |
Dominique Willems | Barry wrote:
> Dominique, > How did you put the data into the byte fields? ..AsString. And to read it: Ord(tbTestByte.AsString[1]) but it was returning empty strings. So I gave up and am now just using SmallInt fields. Bit of a waste, but more elegant. If only a byte field were accessible through AsInteger. |
Mon, Aug 20 2012 7:49 AM | Permanent Link |
Dominique Willems | Malcolm wrote:
> Hmm, I don't have such types but have you tried .AsBytes ? I have. Unsuccessfully. |
Mon, Aug 20 2012 7:50 AM | Permanent Link |
Dominique Willems | Roy Lambert wrote:
> xx:=test.fieldbyname('_bytes').asstring; > yy:=ord(xx[1]); I got access violations because the string was empty, while the field never was. Odd, but I eventually gave up and reverted to SmallInt fields. |
Mon, Aug 20 2012 8:26 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Dominique
Was it unicode or ansi? I tested using ansi cos that's what I use. Roy Lambert [Team Elevate] |
Mon, Aug 20 2012 8:58 AM | Permanent Link |
Dominique Willems | Roy Lambert wrote:
> Was it unicode or ansi? I tested using ansi cos that's what I use. Unicode. |
Mon, Aug 20 2012 10:16 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Dominique
<WARNING> Everything that follows is a guess because I'm still running D2006. </WARNING> In that case you may be hitting the ansi/unicode problem. field.AsString will return a unicode string, Ord I assume has be altered to handle this but you're passing it a single byte and its throwing a wobbly. There may be a specific version for ansichar or you may have to explicity cast your data to ansichar to trigger overloading in the standard version. Roy Lambert [Team Elevate] |
Page 1 of 2 | Next Page » | |
Jump to Page: 1 2 |
This web page was last updated on Tuesday, May 7, 2024 at 06:25 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |