I
ivan526
Unregistered / Unconfirmed
GUEST, unregistred user!
我已经得到recordset,可以显示数据库内容,但是呢
除了显示内容之外,其他操作都不行啊。
例如 rs.movenext,rs.close,rs.recordcount都不行啊,怎么回事呢
部分源码:
uses
ComObj, ActiveX, AspTlb, Project1_TLB, StdVcl,ADODB_TLB,ADODB,dm;
type
Taspcom = class(TASPObject, Iaspcom)
private
FDM:Taspcom_dm;
DataConnection: OleVariant;
protected
procedure OnEndPage;
safecall;
procedure OnStartPage(const AScriptingContext: IUnknown);
safecall;
function Get_ADORecordSet: OleVariant;
safecall;
function GetADOConnection: OleVariant;
safecall;
public
procedure Initialize ;
override;
destructor Destroy;
override;
end;
implementation
uses ComServ;
procedure Taspcom.OnEndPage;
begin
inherited OnEndPage;
end;
procedure Taspcom.OnStartPage(const AScriptingContext: IUnknown);
begin
inherited OnStartPage(AScriptingContext);
end;
destructor Taspcom.Destroy;
begin
if FDM.ADOQuery1.Active then
FDM.ADOQuery1.Close;
FDM.Free;
inherited;
end;
procedure TASPCom.Initialize;
begin
inherited;
try
FDM := Taspcom_dm.Create(nil);
except
;
//do
something
end;
end;
function Taspcom.Get_ADORecordSet: OleVariant;
begin
//Result := nil;
try
FDM.ADOConnection1.Connected:=true;
FDM.ADOTable1.Active:=true;
result:=fdm.ADOTable1.Recordset as RecordSet;
{with FDM.ADOQuery1do
begin
if Active then
Close;
SQL.Clear;
SQL.Add('SELECT * FROM products');
Open;
end;
Result := FDM.ADOQuery1.Recordset ;
}
except
;
// Todo
Something
end;
//result:='tset';
end;
function Taspcom.GetADOConnection: OleVariant;
begin
Result := DataConnection;
end;
除了显示内容之外,其他操作都不行啊。
例如 rs.movenext,rs.close,rs.recordcount都不行啊,怎么回事呢
部分源码:
uses
ComObj, ActiveX, AspTlb, Project1_TLB, StdVcl,ADODB_TLB,ADODB,dm;
type
Taspcom = class(TASPObject, Iaspcom)
private
FDM:Taspcom_dm;
DataConnection: OleVariant;
protected
procedure OnEndPage;
safecall;
procedure OnStartPage(const AScriptingContext: IUnknown);
safecall;
function Get_ADORecordSet: OleVariant;
safecall;
function GetADOConnection: OleVariant;
safecall;
public
procedure Initialize ;
override;
destructor Destroy;
override;
end;
implementation
uses ComServ;
procedure Taspcom.OnEndPage;
begin
inherited OnEndPage;
end;
procedure Taspcom.OnStartPage(const AScriptingContext: IUnknown);
begin
inherited OnStartPage(AScriptingContext);
end;
destructor Taspcom.Destroy;
begin
if FDM.ADOQuery1.Active then
FDM.ADOQuery1.Close;
FDM.Free;
inherited;
end;
procedure TASPCom.Initialize;
begin
inherited;
try
FDM := Taspcom_dm.Create(nil);
except
;
//do
something
end;
end;
function Taspcom.Get_ADORecordSet: OleVariant;
begin
//Result := nil;
try
FDM.ADOConnection1.Connected:=true;
FDM.ADOTable1.Active:=true;
result:=fdm.ADOTable1.Recordset as RecordSet;
{with FDM.ADOQuery1do
begin
if Active then
Close;
SQL.Clear;
SQL.Add('SELECT * FROM products');
Open;
end;
Result := FDM.ADOQuery1.Recordset ;
}
except
;
// Todo
Something
end;
//result:='tset';
end;
function Taspcom.GetADOConnection: OleVariant;
begin
Result := DataConnection;
end;