TClientDataSet中Applyupdate后为什么不能件数据写入数据库? ( 积分: 100 )

  • 主题发起人 主题发起人 iforward
  • 开始时间 开始时间
I

iforward

Unregistered / Unconfirmed
GUEST, unregistred user!
客户端的代码
procedure TForm1.Button4Click(Sender: TObject);
begin
cdsCustomer.Edit;
cdsCustomer.FieldValues['CustomerID']:=edit1.Text;
cdsCustomer.Post;
cdsCustomer.ApplyUpdates(0);
end;

应用服务端如下
unit Unit2;
{$WARN SYMBOL_PLATFORM OFF}
interface
uses
Windows, Messages, SysUtils, Classes, ComServ, ComObj, VCLCom, DataBkr,
DBClient, Project1_TLB, StdVcl, Provider, DB, ADODB;
type
Tpc121 = class(TRemoteDataModule, Ipc121)
ADOTable1: TADOTable;
DataSetProvider1: TDataSetProvider;
ADOConnection1: TADOConnection;
ADOQuery1: TADOQuery;
private
{ Private declarations }
protected
class procedure UpdateRegistry(Register: Boolean;
const ClassID, ProgID: string);
override;
public
{ Public declarations }
end;

implementation
{$R *.DFM}
class procedure Tpc121.UpdateRegistry(Register: Boolean;
const ClassID, ProgID: string);
begin
if Register then
begin
inherited UpdateRegistry(Register, ClassID, ProgID);
EnableSocketTransport(ClassID);
EnableWebTransport(ClassID);
end else
begin
DisableSocketTransport(ClassID);
DisableWebTransport(ClassID);
inherited UpdateRegistry(Register, ClassID, ProgID);
end;
end;

initialization
TComponentFactory.Create(ComServer, Tpc121,
Class_pc121, ciMultiInstance, tmApartment);
end.

数据库是sqlserver2000是在本地机上
当客户端运行后
能够在客户端的dbgrid中显示修改了
可是,sqlserver2000数据库中并未修改
不知道是什么问题?
 
检查这个cdsCustomer.ApplyUpdates(0)返回值,如不为0,则有错误发生,为0才成功写入数据库
 
后退
顶部