Forum > Databases

TBufDataset.First issue.

<< < (2/5) > >>

rvk:
The problem might be that you are trying to stuff a string of 7 characters "ABCDEFG" in a field defined with Size = 5 !! %)

That really messes things up.

Just define the stringfield as a field of 20 characters and the code should work fine.


--- 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,5,-1,False,False,0,CP_UTF8);  bd.FieldDefs.Add('Str5Field', ftString, 20); (I'm also not sure about the other parameters you used in the field-def. But the simple version I used above works.)

Zvoni:

--- Quote from: rvk on January 25, 2023, 10:22:21 am ---The problem might be that you are trying to stuff a string of 7 characters "ABCDEFG" in a field defined with Size = 5 !! %)

That really messes things up.

Just define the stringfield as a field of 20 characters and the code should work fine.


--- 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,5,-1,False,False,0,CP_UTF8);  bd.FieldDefs.Add('Str5Field', ftString, 20); 
--- End quote ---
Was my first thought, too, but doesn't make a difference if you shorten the String to "ABCDE" - same issue.
Just try it.

EDIT: What i noticed: The issue appears when BOF=True, irrespective of the Value of EOF
It returns the correct Value for BOF=False

rvk:

--- Quote from: Zvoni on January 25, 2023, 10:24:08 am ---
--- Quote from: rvk on January 25, 2023, 10:22:21 am ---The problem might be that you are trying to stuff a string of 7 characters "ABCDEFG" in a field defined with Size = 5 !! %)

That really messes things up.

Just define the stringfield as a field of 20 characters and the code should work fine.


--- 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,5,-1,False,False,0,CP_UTF8);  bd.FieldDefs.Add('Str5Field', ftString, 20); 
--- End quote ---
Was my first thought, too, but doesn't make a difference if you shorten the String to "ABCDE" - same issue.
Just try it.

--- End quote ---
And what happens if you use this??

--- 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);
The problem could also be in the precision of -1 or something else.
Using the simple Add() version works for me.

O, or FieldNo. Why is 0 used here?
Shouldn't this be 1????

Zvoni:

--- Quote from: rvk on January 25, 2023, 10:26:08 am ---
--- Quote from: Zvoni on January 25, 2023, 10:24:08 am ---
--- Quote from: rvk on January 25, 2023, 10:22:21 am ---The problem might be that you are trying to stuff a string of 7 characters "ABCDEFG" in a field defined with Size = 5 !! %)

That really messes things up.

Just define the stringfield as a field of 20 characters and the code should work fine.


--- 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,5,-1,False,False,0,CP_UTF8);  bd.FieldDefs.Add('Str5Field', ftString, 20); 
--- End quote ---
Was my first thought, too, but doesn't make a difference if you shorten the String to "ABCDE" - same issue.
Just try it.

--- End quote ---
And what happens if you use this??

--- 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);
The problem could also be in the precision of -1 or something else.
Using the simple Add() version works for me.

--- End quote ---
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)

rvk:

--- 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);

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version