问题描述
我有问题用Delphi XE5 Firedac应用。我用的刀片,中兴通讯3个电话来运行应用程序。我用的部署管理器数据库文件添加到资产\\内部目录。但是,当我打电话FDQuery1.FieldByName('Nimi敬上')。AsString它引发的异常故障分段(11).Thanks。
FDQuery1.SQL.Clear;
FDQuery1.SQL.Add(SELECT * FROM Laskuttaja');FDQuery1.Open();
FDQuery1.First;
而(不FDQuery1.Eof)并开始
FormTiedot.EditNimi.Text:= FDQuery1.FieldByName('Nimi敬上')AsString。
FormTiedot.EditOsoite.Text:= FDQuery1.FieldByName('Osoite')AsString。
FormTiedot.EditY.Text:= FDQuery1.FieldByName('Ytunnus')AsString。
FDQuery1.Next;
结束;
如果FormTiedot.ShowModal = mrOk然后开始
FDQuery1.SQL.Clear;
FDQuery1.SQL.Add('UPDATE Laskuttaja SET Nimi敬上='+ QuotedStr(FormTiedot.EditNimi.Text)+',Osoite ='+ QuotedStr(FormTiedot.EditOsoite.Text)+',Ytunnus ='+ QuotedStr(FormTiedot.EditY。文本));
FDQuery1.SQL.Add('WHERE ID = 1');
在该行出现的错误:
FormTiedot.EditNimi.Text:= FDQuery1.FieldByName('Nimi敬上')AsString。
一个分段故障意味着你指的是无效的内存。因此,这可能引起由于下列原因的至少一种:
-
FormTiedot
是无效的。 -
FormTiedot.EditNimi
是无效的。 -
FDQuery1
是无效的。 -
FDQuery1.FieldByName('Nimi敬上')
收益无
。
现在,据我所知, FieldByName()
抛出一个异常来表示失败,而不是返回无
。和 FDQuery1
肯定是有效的,否则前面的code会失败。
因此,最有可能的结论是:要么 FormTiedot
或 FormTiedot.EditNimi
是无效的。也许你无法实例 FormTiedot
?
I have problem with Delphi XE5 Firedac application. I use ZTE Blade 3 phone to run application. I used deployment manager to add database file to assets\internal directory. But when I call FDQuery1.FieldByName('Nimi').AsString it raises exception Segmentation fault (11).Thanks.
FDQuery1.SQL.Clear;
FDQuery1.SQL.Add('SELECT * FROM Laskuttaja');
FDQuery1.Open();
FDQuery1.First;
while(not FDQuery1.Eof) do begin
FormTiedot.EditNimi.Text := FDQuery1.FieldByName('Nimi').AsString;
FormTiedot.EditOsoite.Text := FDQuery1.FieldByName('Osoite').AsString;
FormTiedot.EditY.Text := FDQuery1.FieldByName('Ytunnus').AsString;
FDQuery1.Next;
end;
if FormTiedot.ShowModal = mrOk then begin
FDQuery1.SQL.Clear;
FDQuery1.SQL.Add('UPDATE Laskuttaja SET Nimi = '+QuotedStr(FormTiedot.EditNimi.Text)+', Osoite = ' + QuotedStr(FormTiedot.EditOsoite.Text) + ', Ytunnus=' + QuotedStr(FormTiedot.EditY.Text));
FDQuery1.SQL.Add('WHERE ID=1');
The error occurs on this line:
FormTiedot.EditNimi.Text := FDQuery1.FieldByName('Nimi').AsString;
A segmentation fault means that you are referring to invalid memory. So, this could arise for at least one of the following reasons:
FormTiedot
is invalid.FormTiedot.EditNimi
is invalid.FDQuery1
is invalid.FDQuery1.FieldByName('Nimi')
returnsnil
.
Now, as far as I know, FieldByName()
raises an exception to indicate failure, rather than returning nil
. And FDQuery1
is surely valid, otherwise the earlier code would have failed.
So, the most likely conclusion is that either FormTiedot
or FormTiedot.EditNimi
are invalid. Perhaps you failed to instantiate FormTiedot
?
这篇关于调用Firedac当Android的Delphi应用程序分割故障(11)例外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!