(DELPHI_XE)Datasnap 'ERROR_CODE'. The allowed range is 0 to 4294967295'
2013-11-15 10:08
423 查看
在用ADO+TClientDataSet操作数据库时,用DataSetProvider.ApplyUpdates更新时
可能会因为某种错误而提示如下:
Project Project1.exe raised exception class EDatabaseError with message '-2147217900 is not a valid value for field 'ERROR_CODE'. The allowed range is 0 to 4294967295'.
跟踪发现错误在 Provider.pas 中
的
这一句,只需要将这一句改成
即可。
因为delphi认为ErrorCode应该是LongWord,不应该出现负数,或者说SQLServer是使用int64来表示ErrorCode。
可能会因为某种错误而提示如下:
Project Project1.exe raised exception class EDatabaseError with message '-2147217900 is not a valid value for field 'ERROR_CODE'. The allowed range is 0 to 4294967295'.
跟踪发现错误在 Provider.pas 中
procedure TUpdateTree.InitErrorPacket(E: EUpdateError; Response: TResolverResponse); var TrueRecNo: LongWord; begin with ErrorDS do begin if Assigned(Parent) then Parent.InitErrorPacket(nil, rrSkip); Self.Delta.UpdateCursorPos; Self.Delta.DSCursor.GetRecordNumber(TrueRecNo); if not Locate('ERROR_RECORDNO', Integer(TrueRecNo), []) then Append else Edit; if not Assigned(E) then begin if Response = rrSkip then begin SetFields([TrueRecNo]); Post; end else SetFields([TrueRecNo, 0, '', '', 0, 0]); end else SetFields([TrueRecNo, Ord(Response)+1, E.Message, '', 1, E.ErrorCode]); end; end;
的
SetFields([TrueRecNo, Ord(Response)+1, E.Message, '', 1, E.ErrorCode]);
这一句,只需要将这一句改成
SetFields([TrueRecNo, Ord(Response)+1, E.Message, '', 1, Variant(LongWord(E.ErrorCode))]);
即可。
因为delphi认为ErrorCode应该是LongWord,不应该出现负数,或者说SQLServer是使用int64来表示ErrorCode。
相关文章推荐
- android Failed to install *.apk on device 'emulator-5554' timeout 或者 the user data image is used解决办法
- ERROR 1130: Host '192.168.1.3' is not allowed to connect to this MySQL
- rapidxml 在mac下的编译error: call to function 'print_pi_node' that is neither visible in the template def
- ERROR 1130: Host 'A'is not allowed to connect to this MySQL server
- mysql:ERROR 1130: Host '192.168.0.102' is not allowed to connect to this MySQL server
- ERROR 1130 (HY000): Host 'localhost' is not allowed to connect to this MySQL server
- 解决adb server didn't ack和 The connection to adb is down, and a severe error has occured的问题
- mysql错误1130,具体描述如下ERROR 1130 Host 'localhost' is not allowed to connect to this MySQL
- ERROR 1130: Host 'A'is not allowed to connect to this MySQL server
- ERROR 1130: Host 'A'is not allowed to connect to this MySQL server
- '4.294967295E9' in column '7' is outside valid range for the datatype INTEGER.
- IT忍者神龟之mysql远程连接:ERROR 1130 (HY000): Host '*.*.*.*' is not allowed to connect to this MySQL server解决
- adb.exe被占用,The connection to adb is down, and a severe error has occured.adb.exe' and can be execute
- How to eliminate the compile error "conversion from 'double ' to 'float ', possible loss of data"
- The connection to adb is down, and a severe error has occured.(解决adb server didn't ACK问题)
- ERROR 1130 (HY000): Host 'xxxxxx' is not allowed to connect to this MySQL server解决办法
- mysql数据库错误ERROR 1130:Host '' is not allowed to connect to this mysql server
- Error: Target id 'android--1' is not valid. Use 'android.bat list targets' to get the target ids.
- Error No. 1130 Host '*.*.*.*' is not allowed to connect to this MySQL server解决方法
- ERROR 1130: Host '192.168.0.207' is not allowed to connect to this MySQL