AnyDac又名FireDac无法生成更新查询 [英] AnyDac aka FireDac cannot generate update query

查看:145
本文介绍了AnyDac又名FireDac无法生成更新查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用UniDac了很长时间,并决定继续使用FireDac,因为它具有良好的Asynch方法,在继续前进后,我发现我的数据编辑都无法正常工作了,它给了我一个错误:


[FireDAC] [Phys] -330。无法生成更新查询。未定义更新表。


我要在这里做的是我有一个TFDStoredProc组件,该组件从数据库中获取所有数据并让我可以使用unidac对其进行编辑,而我可以轻松地编辑数据而不会出现这样的问题:

  StoredProc.Edit; 
StoredProcCreatedID.Value:= SomeValue;
StoredProc.Post;

它可以工作,但是使用AnyDac却没有,我尝试手动指定导致另一个问题:


[FireDAC] [Phys] [ODBC] [Microsoft] [SQL Server Native Client 11.0] [SQL Server]无效列名称为'CreatedID'。


我正在使用Microsoft SQL Server 2012 FireDac 8.0和存储过程来获取结果有什么想法?



PS



查询看起来像这样

  SELECT 
CreatedBy作为CreatedID,
usr.UserName作为CreatedBy
FROM
Sales
左联接
用户usr ON usr.ID = Sales.CreatedBy

就像FireDac更新生成器无法识别字段上的别名一样,我们将不胜感激。

解决方案

这是什么问题,看来如果您在字段的查询中指定别名,则 Origin 属性将设置为别名,而不是我下载的 CNPack 的真实字段,这对于delphi开发人员而言必须具有它也是免费的,运行组件选择器并将所有别名字段更改为它们的真实字段,并且可以工作,但这在FireDac组件中仍然是一个大问题,因为它无法识别别名字段,希望它将来会被修复为每个查询指定应该更新的表以及在我的案例中有220多个存储过程的情况下,如果要从一个大项目迁移的工作分配哪些字段。

I was using UniDac for a long time now and decided to move on to FireDac as it has good Asynch methods after moving on i saw that none of my data editing works anymore it gives me an error:

[FireDAC][Phys]-330. Cannot generate update query. Update table undefined.

What I am trying to do here is i have a TFDStoredProc component who gets all the data from the database and lets me edit it, with unidac I could easily edit the data without any problem like this:

StoredProc.Edit;
StoredProcCreatedID.Value := SomeValue;
StoredProc.Post;

and it worked, but with AnyDac it doesn't, I tried specifying manually the UpdateTable which leads to another problem:

[FireDAC][Phys][ODBC][Microsoft][SQL Server Native Client 11.0][SQL Server]Invalid column name 'CreatedID'.

I am using Microsoft SQL Server 2012 FireDac 8.0 and stored procedures for getting back results any ideas?

P.S.

The query looks like this

SELECT 
    CreatedBy as CreatedID,
    usr.UserName as CreatedBy
FROM 
    Sales
LEFT JOIN 
    Users usr ON usr.ID = Sales.CreatedBy

it looks like the FireDac update builder doesn't recognize the aliases on the fields, any help would be appreciated.

解决方案

Well i figured out what was the issue, it seems that if you specify a alias in the query for a field the Origin property will be set to the alias and not the real field i downloaded CNPack a must have for a delphi developer also its free, ran the component selector and changed all my aliased fields to their real fields and it works, but this is still a big issue in FireDac component because it doesnt recognize the aliased fields, lets hope it will be fixed in the future as to specify for every query what table it should update and what fields that just allot of work if you are migrating from a big project in my case 220+ stored procedures.

这篇关于AnyDac又名FireDac无法生成更新查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆