I guess I must be dense, I'm new to Delphi and am trying to read a sql result into a class to access it easily. I have created a dummy class to test like this:
type
test_class = class
id:integer;
job_number:string;
cust_name :string ;
procedure get_record_data;
end;
Then I call the procedure like this:
procedure test_class.get_record_data;
begin
test_class.Create;
test_class.id := tform3.adoQuery1.FieldByName('id').AsInteger;
test_class.job_number := tform3.adoQuery1.FieldByName('job number').AsString;
test_class.cust_name := tform3.adoQuery1.FieldByName('customer name').AsString;
end;
Then I test my result like this:
procedure TForm3.Button1Click(Sender: TObject);
begin
showmessage('Id number is ' + inttostr(test_class.id));
end;
The showmessage line throws a compiler error that says Method Identifier Expected.
The lines that start with test_class.id:=, test_class.job_number:= and test_class.cust_name:= all give me the same Method Identifier Expected as well as a Missing Operator or semicolon error.
What am I doing wrong? Is there an easier way to go about this? Once I get this done, will null values present an issue?