主题:[讨论]Delphi程序转C++求助
function TDbAccess.gthSubByTrdKnd(tradeKind: String; startDate,
endDate: Tdate): TADODataSet;
var adoDataSet:TadoDataSet;
begin
adoDataSet:=TADODataSet.Create(nil);
adoDataSet.CommandType:=cmdtext ;
adoDataSet.CommandText:='{Call gthSubByTrdKnd(?,?,?)}';
adoDataSet.Connection:=connection;
with adoDataSet.Parameters.AddParameter do begin
DataType:= ftString;
Direction := pdInput;
Name:='v_tradeKind'; //形参名
Numericscale:=0;
precision:=0;
size:=16;
Value := tradeKind; //由变量提供实参的值
end;
with adoDataSet.Parameters.AddParameter do begin
DataType:= ftDate;
Direction := pdInput;
Name:='v_startDate'; //形参名
Numericscale:=0;
precision:=0;
Value := startDate; //由变量提供实参的值
end;
with adoDataSet.Parameters.AddParameter do begin
DataType:= ftDate;
Direction := pdInput;
Name:='v_endDate'; //形参名
Numericscale:=0;
precision:=0;
Value := endDate; //由变量提供实参的值
end;
try
//2004/5/28修改 为解决ADO的BUG(抛出E_FAIL异常)
adoDataSet.Active:=True;
except
on E: Exception do
begin
try
adoDataSet.Open;
except
on E: Exception do
begin
{写系统异常日志};
errlog.errCode:='-20000';
errlog.addErrLog;
showmessage(errlog.Message);
end;
end;
end;
end;
result:=adoDataSet;
end;
endDate: Tdate): TADODataSet;
var adoDataSet:TadoDataSet;
begin
adoDataSet:=TADODataSet.Create(nil);
adoDataSet.CommandType:=cmdtext ;
adoDataSet.CommandText:='{Call gthSubByTrdKnd(?,?,?)}';
adoDataSet.Connection:=connection;
with adoDataSet.Parameters.AddParameter do begin
DataType:= ftString;
Direction := pdInput;
Name:='v_tradeKind'; //形参名
Numericscale:=0;
precision:=0;
size:=16;
Value := tradeKind; //由变量提供实参的值
end;
with adoDataSet.Parameters.AddParameter do begin
DataType:= ftDate;
Direction := pdInput;
Name:='v_startDate'; //形参名
Numericscale:=0;
precision:=0;
Value := startDate; //由变量提供实参的值
end;
with adoDataSet.Parameters.AddParameter do begin
DataType:= ftDate;
Direction := pdInput;
Name:='v_endDate'; //形参名
Numericscale:=0;
precision:=0;
Value := endDate; //由变量提供实参的值
end;
try
//2004/5/28修改 为解决ADO的BUG(抛出E_FAIL异常)
adoDataSet.Active:=True;
except
on E: Exception do
begin
try
adoDataSet.Open;
except
on E: Exception do
begin
{写系统异常日志};
errlog.errCode:='-20000';
errlog.addErrLog;
showmessage(errlog.Message);
end;
end;
end;
end;
result:=adoDataSet;
end;