Forum > Databases
TBufDataset.First issue.
rvk:
--- Quote from: rvk on January 25, 2023, 10:29:57 am ---
--- Quote from: Zvoni on January 25, 2023, 10:28:27 am ---Yes, i wondered about that, too (since when do you need precision for Strings?!?!), but i think OP used this overloaded function because of the following params after precision (required, readonly, codepage)
--- End quote ---
I think the fieldNo of 0 is the problem.
Make it one (1) and it works.
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- // bd.FieldDefs.Add('Str5Field', ftString, 20); bd.FieldDefs.Add('Str5Field',ftString,5,-1,False,False,1,CP_UTF8);
--- End quote ---
Yep. From the source:
--- Quote --- // the fielddef will register itself here as an owned component.
// fieldno is 1 based !
--- End quote ---
So don't use field 0 but start on 1 !!!!
Not sure if there is any documentation for this :P
Zvoni:
--- Quote ---
--- Quote from: rvk on January 25, 2023, 10:34:34 am ---
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- // bd.FieldDefs.Add('Str5Field', ftString, 20); bd.FieldDefs.Add('Str5Field',ftString,5,-1,False,False,1,CP_UTF8);
--- End quote ---
Yep. From the source:
--- Quote --- // the fielddef will register itself here as an owned component.
// fieldno is 1 based !
--- End quote ---
So don't use field 0 but start on 1 !!!!
Not sure if there is any documentation for this :P
--- End quote ---
Yep, that's it.
Result
--- Quote ---RecCount=0
RecCount=1
BOF=FALSE - EOF=FALSE
recNo=1 - s=ABCDEFG
BOF=TRUE - EOF=FALSE
recNo=1 - s=ABCDEFG
BOF=FALSE - EOF=TRUE
recNo=1 - s=ABCDEFG
BOF=TRUE - EOF=FALSE
recNo=1 - s=ABCDEFG
--- End quote ---
Still doesn't explain the BOF/EOF confusion
TRon:
Confirmed that rvk's solution works.
I agree with Zvoni wrt documentation (I was unable to locate it, though the property is named fielNo as in number not index). Even a exception on providing a 'illegal' field number would have been helpful.
I seem to remember there being something being off with eof/bof. From what I remember it was logical it acted this way (I seem unable to locate the conversation as I was not part of it, should be here on the forum)
rvk:
--- Quote from: Zvoni on January 25, 2023, 10:40:48 am ---Result
--- Quote ---RecCount=0
RecCount=1
BOF=FALSE - EOF=FALSE
recNo=1 - s=ABCDEFG
BOF=TRUE - EOF=FALSE
recNo=1 - s=ABCDEFG
BOF=FALSE - EOF=TRUE
recNo=1 - s=ABCDEFG
BOF=TRUE - EOF=FALSE
recNo=1 - s=ABCDEFG
--- End quote ---
Still doesn't explain the BOF/EOF confusion
--- End quote ---
What confusion?
They are correct in this example. (or am I missing something?)
BOF and EOF are not set until they are actually encountered.
With a POST they are not set. Only with Last, First, Next and Prior (and only in the direction you where going).
wp:
--- Quote from: rvk on January 25, 2023, 10:34:34 am ---Not sure if there is any documentation for this :P
--- End quote ---
https://www.freepascal.org/docs-html/fcl/db/tfield.fieldno.html ("It is a 1-based index")
Navigation
[0] Message Index
[#] Next page
[*] Previous page