专门为ADO二层升三层的咏南中间件(特种用途)
演示下载:链接: https://pan.baidu.com/s/1bulGBIZ6A1nkeErxIrGsGA 密码: 22dk
解压后运行ynmain.exe
DELPHI7 开发的ADO二层C/S程序升级为三层变得异常简单。
中间件采用INDY9+ADO,在DELPHI7下直接可以编译。
有意者请向本人索取演示程序。
升级步骤:
1)安装TynDATASET控件
2)在客户端将ADOQUERY替换为ynDATASET数据集控件,原ADOQUERY的语法完全不用改,ynDATASET数据集控件兼容ADOQUERY的语法。
演示代码如下:
procedure TForm1.Button1Click(Sender: TObject);
begin
// 执行查询SQL
ynDataSet1.Close;
yndataset1.SQL.Clear;
ynDataSet1.SQL.Add('select * from t1 where c1=:c1');
ynDataSet1.Parameters.ParamByName('c1').AsInteger := 1;
ynDataSet1.Open;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
// 保存修改后的数据
ynDataSet1.Post;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
// 执行非查询SQL
ynDataSet1.Close;
ynDataSet1.SQL.Clear;
ynDataSet1.SQL.Add('update t1 set c3=999 where c1=:c1');
ynDataSet1.Parameters.ParamByName('c1').AsInteger := 1;
ynDataSet1.ExecSQL;
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
// 执行存储过程
ynDataSet1.Close;
ynDataSet1.ProcedureName := 'sp_test';
ynDataSet1.Parameters.ParamByName('@c1').AsInteger := 1;
ynDataSet1.Open;
end;
procedure TForm1.Button5Click(Sender: TObject);
begin
// 执行存储过程2
ynDataSet1.Close;
ynDataSet1.ProcedureName := 'sp_test';
ynDataSet1.Parameters.ParamByName('@c1').AsInteger := 1;
ynDataSet1.ExecProc;
end;