北
北丐洪七
Unregistered / Unconfirmed
GUEST, unregistred user!
下面是我的写的程序,在远程数据模块中声明了一个SaveData方法,要求客户端传送ClientDataSet里的Data和Delat给服务器。
服务端执行Provider.ApplyUpdates,但总是出现SQL Server错误。大家给看看!!
客户端调用程序
procedure TFmClientMain.Button2Click(Sender: TObject);
var
AParam,AData : OleVariant;
AMsg : widestring;
begin
if not Mandm.SckConn.Connected then
Mandm.SckConn.Connected := true;
if ClientDataSet1.State = dsBrowse then
Mandm.SckConn.AppServer.saveData('BP_Area',AParam,ClientDataSet1.Data,
ClientDataSet1.delta,AMsg);
end;
服务端程序
function THebSteelRemoteDm.SaveData(const ABillName: WideString;
AParam: OleVariant;
var AData: OleVariant;
var ADelta: OleVariant;
var AMsg: WideString): WordBool;
var
OutErr : integer;
StrSQL : string;
begin
StrSQL := GetSQLFromAParam(ABillName,AParam);
AppSqlBase.Active := false;
AppSqlBase.SQL.Text := StrSql;
AppSqlBase.Active := true;
//上面代码为设置一个Query
try
AppCdsBase.Active := false;
//服务端的ClientDataSet
AppCdsBase.data := AData;
AppCdsBase.Active := true;
AppDspBase.ApplyUpdates(ADelta,-1,OutErr,AData);//Provider
AMsg := '提交数据完成,保存成功!!!';
Result := true;
except
AMsg := '写入数据库错误!!!';
Result := false;
end;
end;
服务端执行AppDspBase.ApplyUpdates(ADelta,-1,OutErr,AData);//Provider时报SQL Server错误。不能更新Delta中数据到数据库。
服务端执行Provider.ApplyUpdates,但总是出现SQL Server错误。大家给看看!!
客户端调用程序
procedure TFmClientMain.Button2Click(Sender: TObject);
var
AParam,AData : OleVariant;
AMsg : widestring;
begin
if not Mandm.SckConn.Connected then
Mandm.SckConn.Connected := true;
if ClientDataSet1.State = dsBrowse then
Mandm.SckConn.AppServer.saveData('BP_Area',AParam,ClientDataSet1.Data,
ClientDataSet1.delta,AMsg);
end;
服务端程序
function THebSteelRemoteDm.SaveData(const ABillName: WideString;
AParam: OleVariant;
var AData: OleVariant;
var ADelta: OleVariant;
var AMsg: WideString): WordBool;
var
OutErr : integer;
StrSQL : string;
begin
StrSQL := GetSQLFromAParam(ABillName,AParam);
AppSqlBase.Active := false;
AppSqlBase.SQL.Text := StrSql;
AppSqlBase.Active := true;
//上面代码为设置一个Query
try
AppCdsBase.Active := false;
//服务端的ClientDataSet
AppCdsBase.data := AData;
AppCdsBase.Active := true;
AppDspBase.ApplyUpdates(ADelta,-1,OutErr,AData);//Provider
AMsg := '提交数据完成,保存成功!!!';
Result := true;
except
AMsg := '写入数据库错误!!!';
Result := false;
end;
end;
服务端执行AppDspBase.ApplyUpdates(ADelta,-1,OutErr,AData);//Provider时报SQL Server错误。不能更新Delta中数据到数据库。