BMS-HOSxP Community

HOSxP => Delphi / Pascal => ข้อความที่เริ่มโดย: ittipol ที่ กุมภาพันธ์ 03, 2014, 08:48:09 AM

หัวข้อ: ButtonEdit
เริ่มหัวข้อโดย: ittipol ที่ กุมภาพันธ์ 03, 2014, 08:48:09 AM
อาจารย์ครับ
ช่วยแนะนำการใช้งาน ButtonEdit
ในโปรแกรม Delphi ในการดึงข้อมูลหน่อยครับ
ขอบคุณครับ
หัวข้อ: Re: ButtonEdit
เริ่มหัวข้อโดย: apisak ที่ พฤษภาคม 29, 2014, 08:02:55 AM
เรียนรู้ร่วมกันครับ
Accessing Field Values with a Dataset's FieldByName Method
รูปแบบ
FDQuery1.Fields[0].AsString;
Edit1.Text := FieldByName('username').AsString;

ตัวอย่าง
RzEdit1.Text := q_list_office.Fields[0].AsString ;
RzEdit2.Text := q_list_office.Fields[6].AsString ;

RzEdit1.Text := q_list_office.FieldByName('stock_manual_id').AsString ;
RzEdit2.Text := q_list_office.FieldByName('department_id').AsString ;

หมายเหตุไม่สามารถใช้ ใช้ชื่อย่อได้ Alas
m.stock_department_id  ต้องใช้ stock_department_id

//
Edit2.Text := Customers.FieldByName('CustNo').AsString;
Edit2->Text = Customers->FieldByName("CustNo")->AsString;
Conversely, you can assign a value to a field:
begin
  Customers.Edit;
  Customers.FieldByName('CustNo').AsString := Edit2.Text;
  Customers.Post;
end;
Customers->Edit();
Customers->FieldByName("CustNo")->AsString = Edit2->Text;
Customers->Post();