Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/delphi/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql server 2005 在Delphi 5中从SQL Server表中检索longint字段的正确方法_Sql Server 2005_Delphi_Delphi 5 - Fatal编程技术网

Sql server 2005 在Delphi 5中从SQL Server表中检索longint字段的正确方法

Sql server 2005 在Delphi 5中从SQL Server表中检索longint字段的正确方法,sql-server-2005,delphi,delphi-5,Sql Server 2005,Delphi,Delphi 5,在SQL Server 2005中,我有一个值为-7590730850027557904的字段,我正在通过Delphi 5中的ADO检索它,但检索到的是7590730850027557904-省略了负号。从SQL Server到Delphi 5检索长期值的正确方法是什么 这是我的密码 with DataSet do begin Connection := Conn; CommandText := 'SELECT * FROM CUSTOMERSLIST'; Ope

在SQL Server 2005中,我有一个值为-7590730850027557904的字段,我正在通过Delphi 5中的ADO检索它,但检索到的是7590730850027557904-省略了负号。从SQL Server到Delphi 5检索长期值的正确方法是什么

这是我的密码

  with DataSet do
  begin
    Connection := Conn;
    CommandText := 'SELECT * FROM CUSTOMERSLIST';
    Open;
  end;
  ShowMessage(DataSet.FieldByName('SID').AsString);

SQL Server具有bigint类型。
从-2^63(-9223372036854775808)到2^63-1(9223372036854775807)。

在Delphi中相当于Int64

感谢我的同事。解决方案是在从数据库查询时将bigint转换为字符串

 with DataSet do
  begin
    Connection := Conn;
    CommandText := 'SELECT CASST(SID AS VARCHAR(50)) AS SID FROM CUSTOMERSLIST';
    Open;
  end;
  ShowMessage(DataSet.FieldByName('SID').AsString);

Longint
不是有效的sql server数据类型。您必须提供字段的
确切类型来帮助您。