D
dlss
Unregistered / Unconfirmed
GUEST, unregistred user!
看下面的代码怎么错了:
function GetUserInfo: string;
var
adoq: TADOQuery;
cds: TClientDataSet;
dsp: TDataSetProvider;
vData: string;
begin
adoq := TADOQuery.Create(nil);
adoq.Connection := fmLogon.adocMain;
adoq.Active := false;
adoq.SQL.Clear;
adoq.SQL.Add('Select * from T_LOGIN_USER');
adoq.Active := true;
dsp := TDataSetProvider.Create(nil);
dsp.DataSet := adoq;
dsp.Options := [poAllowCommandText];
dsp.Name:='dsp';
cds := TClientDataSet.Create(nil);
cds.ProviderName := 'dsp';
cds.CommandText := 'Select * from T_LOGIN_USER';
cds.Active := true; //出错:Missing Data Provider or Data Packed
vData := cds['Pwd'];
result := vData;
cds.Free;
dsp.Free;
adoq.Free;
end;
奇怪,我已经指定cds.ProviderName := 'dsp1'; 为什么还提示错误
function GetUserInfo: string;
var
adoq: TADOQuery;
cds: TClientDataSet;
dsp: TDataSetProvider;
vData: string;
begin
adoq := TADOQuery.Create(nil);
adoq.Connection := fmLogon.adocMain;
adoq.Active := false;
adoq.SQL.Clear;
adoq.SQL.Add('Select * from T_LOGIN_USER');
adoq.Active := true;
dsp := TDataSetProvider.Create(nil);
dsp.DataSet := adoq;
dsp.Options := [poAllowCommandText];
dsp.Name:='dsp';
cds := TClientDataSet.Create(nil);
cds.ProviderName := 'dsp';
cds.CommandText := 'Select * from T_LOGIN_USER';
cds.Active := true; //出错:Missing Data Provider or Data Packed
vData := cds['Pwd'];
result := vData;
cds.Free;
dsp.Free;
adoq.Free;
end;
奇怪,我已经指定cds.ProviderName := 'dsp1'; 为什么还提示错误