ลองเอาไปปรับดูครับ
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Mask, DBCtrls, Grids, DBGrids, DB, DBClient;
type
TForm2 = class(TForm)
ClientDataSet1: TClientDataSet;
DataSource1: TDataSource;
DBGrid1: TDBGrid;
DBEdit1: TDBEdit;
Pttype: TButton;
procedure PttypeClick(Sender: TObject);
procedure DBGrid1CellClick(Column: TColumn);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.PttypeClick(Sender: TObject);
begin
ClientDataSet1.data:=hosxp_getdataset('select * from pttype');
end;
end.
form
object Form2: TForm2
Left = 0
Top = 0
Caption = 'Form2'
ClientHeight = 380
ClientWidth = 558
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object DBGrid1: TDBGrid
Left = 8
Top = 120
Width = 521
Height = 209
DataSource = DataSource1
TabOrder = 0
TitleFont.Charset = DEFAULT_CHARSET
TitleFont.Color = clWindowText
TitleFont.Height = -11
TitleFont.Name = 'Tahoma'
TitleFont.Style = []
end
object DBEdit1: TDBEdit
Left = 351
Top = 60
Width = 178
Height = 21
DataField = 'name'
DataSource = DataSource1
TabOrder = 1
end
object Pttype: TButton
Left = 103
Top = 58
Width = 90
Height = 25
Caption = 'Show Pttype'
TabOrder = 2
OnClick = PttypeClick
end
object ClientDataSet1: TClientDataSet
Active = True
Aggregates = <>
Params = <>
Left = 24
Top = 48
Data = {
D70200009619E0BD010000001800000004001600000003000000940004636F64
6501004900000002000557494454480200020002000950524F56464C41475304
00018007000000046E616D650100490000000100055749445448020002009600
076167655F6D696E0400010000000000076167655F6D61780400010000000000
01000B5052494D4152595F4B455902008200010000000100005002413120A8E8
D2C2E0A7D4B9E0CDA720E2B4C2E4C1E8C1D5CAD4B7B8D4E0BAD4A1A4D7B90050
0241321DE3AAE9CAD4B7B8D4E0BAD4A1CBB9E8C7C2A7D2B9B5E9B9CAD1A7A1D1
B4005002413315CAD4B7B8D4C5B4CBC2E8CDB920BBC3D0E0C0B720A100500241
3415CAD4B7B8D4C5B4CBC2E8CDB920BBC3D0E0C0B720A2005002413515CAD4B7
B8D4C5B4CBC2E8CDB920BBC3D0E0C0B720A4005002413615CAD4B7B8D4C5B4CB
C2E8CDB920BBC3D0E0C0B720A700500241371EBCD9E9BBC3D0A1D1B9B5B9B5D2
C120BEC3BA2EBBC3D0A1D1B9CAD1A7A4C100500241380FA1CDA7B7D8B9E0A7D4
B9B7B4E1B7B9005002413922BBC3D0A1D1B9C0D1C220B5D2C120BEC3BA2EBCD9
E9BBC3D0CABAC0D1C2A8D2A1C3B600500241410EE0B4E7A12030202D20313220
BBD5005002414213BAD1B5C3BCD9E9C1D5C3D2C2E4B4E9B9E9CDC20050024143
0CBAD1B5C3B9D1A1E0C3D5C2B900500241440CBAD1B5C3BCD9E9BED4A1D2C300
500241450BB7CBD2C3BCE8D2B9C8D6A1005002414613BEC3D0C0D4A1C9D820BC
D9E9B9D3C8D2CAB9D200500241470EBAD1B5C3BCD9E9CAD9A7CDD2C2D8005002
41480CBAD1B5C3AAD1E8C7A4C3D2C7005002414918BAD1B5C3CAD8A2C0D2BE20
BBC3D0AAD2AAB9B7D1E8C7E4BB005002414A0FBAD1B5C3CAD8A2C0D2BE20CDCA
C12E005002414B15BAD1B5C3CAD8A2C0D2BE20BCD9E9B9D3AAD8C1AAB9005002
414C13BAD1B5C3CAD8A2C0D2BE20B5E8D2A7B4E9D2C700500255431FBAD1B5C3
BBC3D0A1D1B9CAD8A2C0D2BEB6E9C7B9CBB9E9D220333020BAD2B7}
end
object DataSource1: TDataSource
DataSet = ClientDataSet1
Left = 64
Top = 48
end
end