我一直在评估Delphi XE4(针对win32编译,但最终平台将是iOS),我需要创建sqlite数据库(没问题)并进行一些查询.这是我想要使用的一个查询:
select id as _id,name,note as description from notes
这是我的代码:
q := TsqlQuery.Create(nil); try q.sqlConnection := MainForm.sqlite1; q.sql.Text := sql; q.Open; finally q.Free; end;
问题是查询返回原始字段名称(id,note),而不是我使用的名称(_id,description).
q.Fields[0].FieldName = 'id' //it should be _id q.Fields[2].FieldName = 'note' //it should be description
这会产生各种各样的问题.运用
count(*) as myfield
回报
q.Fields[0].FieldName = Column0 //it should be myfield
这是不可接受的.
有人有同样的问题吗?