Problem with Large Integer

Problem with Large Integer

Postby bmichene » Thu 05 May 2005 20:31

I'm having a problem copying the data (value) from one record to another only when the field type of ftLargeint. If the field is of this type, the value is not assigned. Below is a snipet of code; query1 does a select * from a table and query2 does the same from the same table. When I loop through the fields from query1 and assign the values from there to a new record in query2 all values are properly assigned to the new record except those that are largeint. I have commented out the code that will work around the issue, but I was wonder why I have to do it this way (if the datatype is smallint it works fine also).

procedure TForm1.BitBtn2Click(Sender: TObject);
var
i: integer;
begin
with myquery2 do
begin
close;
Open;
insert;
for i := 1 to myquery1.FieldCount - 1 do
begin
// if fields[i].DataType in [ftLargeint] then
// fields[i].asinteger := myquery1.fields[i].asinteger
// else
fields[i].Value := myquery1.fields[i].Value;
end;
post;
end;
myquery1.Refresh;
end;
bmichene
 

code formatting

Postby bmichene » Thu 05 May 2005 20:34

Sorry for the code not being formatted as I did a cut-n-paste and the leading spaces were apparently removed.
bmichene
 

dblookupcombo

Postby bmichene » Fri 06 May 2005 01:40

I'm having the same issue with a TDBLookupCombo when the datasource field is integer or bigint (it is fine with small and medium), selecting a new value from the combo drop down list will put the dataset into edit mode, but the value does not change to the new value.

What is going on? Please help. I'm evaluating these components and if this sort of problem can't be resolved, I'd be hard press to purchase.
bmichene
 

Postby Ikar » Fri 06 May 2005 07:43

We reproduced the error but unfortunately couldn't fix it. The reason of this problem is that it's impossible to assign a value through TLargeIntField.Value (see unit DB, TLargeintField.SetVarValue).

For Lookup and Master-Detail you have to refuse from using ftLargeInt fields.

To copy values you should change a line

fields[i].asinteger := myquery1.fields[i].asinteger

to

TLargeIntField(fields[i]).AsLargeInt := TLargeIntField(myquery1.fields[i]).AsLargeInt
Ikar
 
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Large Int

Postby bmichene » Fri 06 May 2005 14:51

Thank you for the quick response. I did some more testing and found that I can still use integer type if I define it as signed as oppossed to unsigned.
bmichene
 


Return to MySQL Data Access Components