ClientDataSet调用方法(实际上就是三层中的远端执行):
procedure TMain.btn_ClientDataSetExecClick(Sender: TObject); begin DataSource1.DataSet := ClientDataSet1; ClientDataSet1.ProviderName := 'DataSetProvider1'; DataSetProvider1.DataSet.Close; //即执行了 Adoquery1.Close; ClientDataSet1.Close; ClientDataSet1.CommandText := 'Execute up_TestAdoExec :@inVar,:@outVar output'; ClientDataSet1.Params.Clear; //调用存储过程时,必须把此语句放在对CommandText的赋值操作之后 ClientDataSet1.Params.CreateParam(ftString,'@inVar',ptInput); ClientDataSet1.Params.CreateParam(ftString,'@outVar',ptOutput); ClientDataSet1.Params.ParamByName('@inVar').Size := 100; ClientDataSet1.Params.ParamByName('@inVar').Value := Edit1.Text; ClientDataSet1.Params.ParamByName('@outVar').Size := 100; //ClientDataSet1.Params.ParamByName('@outVar').Value := Edit2.Text; //ClientDataSet1.Execute;//如果不返回结果集,执行此语句 ClientDataSet1.Open; Edit2.Text := ClientDataSet1.Params.ParamByName('@outVar').Value; end;