我正在为我的公司将BDE转换为ADO。我已经运行到一个表达我无法弄清楚如何转换到ADO德尔福2010年BDE到ADO转换
这里是BDE表达除了一个....这是造成我发出部分的所有ADO变化是
与Tquery.Create(零)在一开始做。有任何想法吗?
with Tquery.Create(nil) do
begin
cmd := TStringList.Create;
cmd.Add('select top 3 csnttext from casenotesint');
cmd.Add('where csntcaseid = ''' + scasenum + ''' ');
cmd.Add('and csntclmid = ''' + sclmnumber + ssplitcode + ''' ');
cmd.Add('order by csntseqnum desc');
rs := fConnection.Execute(cmd.Text);
cmd.Free;
while not Eof do
begin
SAPrintReport1.Tab(0.5);
SAPrintReport1.Print(rs.Fields.Item('CsNtText').Value);
SAPrintReport1.NewLine;
rs.next;
end;
rs.Close;
end;
if cbxSpacer.checked then
begin
SAPrintReport1.NewLine;
SAPrintReport1.NewLine;
SAPrintReport1.NewLine;
end;
我正确地认为BDE,ADO和Delphi 2010实际上与您的问题无关吗?你真的只是问什么“用Tquery.Create(零)做”的意思,对吧? – 2010-06-30 20:20:59
代码是否正确?你正在创建一个TQuery并使用它的Eof属性(由于with),但是你正在迭代rs。此外,我会在where子句中使用参数,希望对输入进行检查和消毒,或者如果您的用户足够熟练(除了可能每次都迫使查询难以解析),可能会发生“有趣”的事情。 – 2010-06-30 21:14:38
由于您的问题到最后,而不是您发布的代码,您应该修改您的问题或删除它,使StackOverflow更有用的地方,噪音更少。 – 2010-07-01 13:13:41