R
ron_xin
Unregistered / Unconfirmed
GUEST, unregistred user!
First chance exception at $75CA9617. Exception class TDBXError with message'SQL State: 42000, SQL Error Code: 260不允许从数据类型 varchar 到数据类型 money 的隐性转换(表 'Orders',列 'Amount')。请使用 CONVERT 函数来运行此查询。'.Process Server.exe (688)First chance exception at $75CA9617. Exception class EDatabaseError with message 'Unable to find record. No key specified'. Process Server.exe (688)DataSnap三层,服务端保存代码如下:,如果我将Amount改为Integer类型,则没有问题。我用的是Delphi 2010
[]
代码:
function TServerMethods1.MyApplyUpdates(TableName: String;
Delta: OleVariant;out err: String): Boolean;const sql='select * from %s where 1=0 ';var ErrCount:Integer;
TD:TTransactionDesc;
sqlstr :string;
begin
Result:=False;
TD.TransactionID := 1;
TD.IsolationLevel := xilREADCOMMITTED;
SQLConnection1.StartTransaction(TD);
try SQLQuery1.Close;
sqlstr:=Format(sql,[TableName]);
SQLQuery1.sql.text:=sqlstr;
SQLQuery1.open;
DataSetProvider1.ApplyUpdates(Delta,-1,ErrCount);
Result:=ErrCount=0;
if Result then
SQLConnection1.Commit(TD) else
SQLConnection1.Rollback(TD);
//SQLQuery1.Close;
except on E:Exceptiondo
begin
SQLConnection1.Rollback(TD);
err:=E.Message +' # '+inttostr(ErrCount);
end;
end;
end;