为什么我动态更新TClientDataSet的CommandText老是出错
腊月三毛 2003-11-21 05:54:32 将某个TClientDataSet的CommandText改为:"select * from a",成功.
紧接着第二次更改其CommandText为:"selec * from b where ..."失败,代码大概如下:
...
with MainDataModule.cdsQueryData do
begin
try
close;
commandtext:='select fieldname1 from tablename where fieldname2='xxx'";
open;
if isempty then
WebApplication.ShowMessage('请输入值!')
else
if fields[0].AsInteger=0 then WebApplication.ShowMessage('输入值无效!')
else ShowForm(TfrmMainForm);
except
WebApplication.ShowMessage(系统远程查询出错!');
end;
end;
...
相关联的TDataSetProvider的Options:=[poAllowCommandText];
错误提示是"对象没有连接到服务器"
百试不得其解,初学写三层,包涵包涵.三层结构为:
MS SQL Server
DCOM ADO
IntraWeb