Project: ThinPlus2009Client.dproj |
Project Structure |
|
ThinPlus2009Client.dpr |
program ThinPlus2009Client;
uses
Forms,
ThinForm in 'ThinForm.pas' {ClientForm},
QueForm in 'QueForm.pas' {FormQuery};
{$R *.RES}
begin
Application.Initialize;
Application.CreateForm(TClientForm, ClientForm);
Application.CreateForm(TFormQuery, FormQuery);
Application.Run;
end. |
ThinForm.pas |
unit ThinForm;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
DBClient, MConnect, SConnect, provider, Db, Grids, DBGrids, StdCtrls, ObjBrkr, MidasLib,
WideStrings, DbxDatasnap, DSConnect, SqlExpr, FMTBcd;
type
TClientForm = class(TForm)
cds: TClientDataSet;
DBGrid1: TDBGrid;
DataSource1: TDataSource;
btnFetch: TButton;
btnApply: TButton;
CheckBox1: TCheckBox;
Edit2: TEdit;
Edit3: TEdit;
cdsDet: TClientDataSet;
DataSource2: TDataSource;
DBGrid2: TDBGrid;
btnQuery: TButton;
btnRecCount: TButton;
cdsDEPT_NO: TStringField;
cdsDEPARTMENT: TStringField;
cdsHEAD_DEPT: TStringField;
cdsMNGR_NO: TSmallintField;
cdsBUDGET: TFMTBCDField;
cdsLOCATION: TStringField;
cdsPHONE_NO: TStringField;
cdsSQLEmployees: TDataSetField;
SQLConnection1: TSQLConnection;
DSProviderConnection1: TDSProviderConnection;
SqlServerMethod1: TSqlServerMethod;
procedure btnFetchClick(Sender: TObject);
procedure btnApplyClick(Sender: TObject);
procedure CheckBox1Click(Sender: TObject);
procedure btnQueryClick(Sender: TObject);
procedure btnRecCountClick(Sender: TObject);
procedure SQLConnection1AfterConnect(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
ClientForm: TClientForm;
implementation
uses QueForm;
{$R *.DFM}
procedure TClientForm.btnFetchClick(Sender: TObject);
begin
btnFetch.Caption := IntToStr (cds.GetNextPacket);
end;
procedure TClientForm.btnApplyClick(Sender: TObject);
begin
cds.ApplyUpdates(-1);
end;
procedure TClientForm.CheckBox1Click(Sender: TObject);
begin
SQlConnection1.Connected := Checkbox1.Checked;
cds.Active := Checkbox1.Checked;
end;
procedure TClientForm.btnQueryClick(Sender: TObject);
begin
FormQuery.Show;
end;
procedure TClientForm.btnRecCountClick(Sender: TObject);
begin
showMessage (IntToStr (cds.RecordCount));
end;
procedure TClientForm.SQLConnection1AfterConnect(Sender: TObject);
begin
// was: ConnectionBroker1.AppServer.Login (Edit2.Text, Edit3.Text);
SqlServerMethod1.ParamByName('Name').AsString := Edit2.Text;
SqlServerMethod1.ParamByName('Password').AsString := Edit3.Text;
SqlServerMethod1.ExecuteMethod;
end;
end. |
ThinForm.pas.dfm |
ΓΏ |
QueForm.pas |
unit QueForm;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Db, StdCtrls, Grids, DBGrids, DBClient;
type
TFormQuery = class(TForm)
cdsQuery: TClientDataSet;
DBGrid1: TDBGrid;
btnParam: TButton;
DataSource1: TDataSource;
Label1: TLabel;
ComboBox1: TComboBox;
procedure btnParamClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FormQuery: TFormQuery;
implementation
uses ThinForm;
{$R *.DFM}
procedure TFormQuery.btnParamClick(Sender: TObject);
begin
cdsQuery.Close;
cdsQuery.Params[0].AsString := ComboBox1.Text;
cdsQuery.Open;
Caption := 'Data sent at ' + TimeToStr (
TDateTime (cdsQuery.GetOptionalParam('Time')));
Label1.Caption := 'Param ' +
cdsQuery.GetOptionalParam('Param');
end;
end. |
QueForm.pas.dfm |
object FormQuery: TFormQuery
Left = 265
Top = 137
Caption = 'FormQuery'
ClientHeight = 252
ClientWidth = 474
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 288
Top = 24
Width = 32
Height = 13
Caption = 'Label1'
end
object DBGrid1: TDBGrid
Left = 40
Top = 48
Width = 417
Height = 201
DataSource = DataSource1
TabOrder = 0
TitleFont.Charset = DEFAULT_CHARSET
TitleFont.Color = clWindowText
TitleFont.Height = -11
TitleFont.Name = 'MS Sans Serif'
TitleFont.Style = []
end
object btnParam: TButton
Left = 184
Top = 16
Width = 75
Height = 25
Caption = 'Apply Param'
TabOrder = 1
OnClick = btnParamClick
end
object ComboBox1: TComboBox
Left = 40
Top = 16
Width = 121
Height = 21
Style = csDropDownList
ItemHeight = 13
TabOrder = 2
Items.Strings = (
'Eng'
'VP'
'Mktg'
'Mngr'
'Admin'
'Finan'
'Sales'
'CEO'
'Dir'
'SRep'
'Doc'
'PRel')
end
object cdsQuery: TClientDataSet
Aggregates = <>
Params = <
item
DataType = ftString
Name = 'Country'
ParamType = ptUnknown
Value = 'US'
end>
ProviderName = 'ProviderQuery'
RemoteServer = ClientForm.DSProviderConnection1
Left = 320
Top = 16
end
object DataSource1: TDataSource
DataSet = cdsQuery
Left = 376
Top = 16
end
end |
HTML file generated by PasToWeb, a tool by Marco Cantù
Copyright 2008 Marco Cantù |
|