J
jacky_20001
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TFrmMain.BitBtn3Click(Sender: TObject);
procedure oCustomTask2_Trans_S1(oCustomTask2: DataPumpTask2);
var
oTransformationOld: Transformation;
oTransformation: Transformation2;
begin
oTransformationOld := oCustomTask2.Transformations.New('DTS.DataPumpTransformCopy');
oTransformation := oTransformationOld as Transformation2;
oTransformation.Name := 'DirectCopyXform';
oTransformation.TransformFlags := 63;
oTransformation.ForceSourceBlobsBuffered := 0;
oTransformation.ForceBlobsInMemory := False;
oTransformation.InMemoryBlobSize := 1048576;
oTransformation.TransformPhases := 4;
oCustomTask2.Transformations.Add(oTransformation);
oTransformation := nil;
oTransformationOld := nil;
end;
var
opackageold : package;
opckage : package;
dts_conn, dts_conn2 : connection; //数据库的连接
dts_task : task;
dts_customtask : customtask;
dts_pumptask : datapumptask2;
dts_step : step;
begin
opackageold := Copackage.Create;
opckage := opackageold as package;
//opckage := Createoleobject('DTS.Package');
dts_conn := opckage.Connections.New('SQLOLEDB');
dts_conn2 := opckage.Connections.New('SQLOLEDB');
dts_conn.Catalog := 'db_pay';
dts_conn.ID := 1;
dts_conn.DataSource := 'bcj';
dts_conn.UserID := 'sa';
dts_conn.Password := '00';
//dts_conn.Reusable := true;
//dts_Conn.UseTrustedConnection := false;
//dts_conn.ConnectImmediate := false;
dts_conn2.Catalog := 'db_pay';
dts_conn2.ID := 2;
dts_conn2.DataSource := 'bcj';
dts_conn2.UserID := 'sa';
dts_conn2.Password := '00';
//dts_conn2.Reusable := true;
//dts_Conn2.UseTrustedConnection := false;
//dts_conn2.ConnectImmediate := false;
opckage.Connections.Add(dts_conn);
opckage.Connections.Add(dts_conn2);
dts_step := opckage.Steps.New;
dts_task := opckage.Tasks.New('DTSdatapumptask');
dts_task.Name := 'copy table';
dts_customtask := dts_task.CustomTask;
dts_pumptask := dts_customtask as datapumptask2;
dts_pumptask.Name := 'copy table';
dts_pumptask.SourceConnectionID := 1;
//dts_pumptask.sourceObjectName := 'TCardSoucesdfsdf';
dts_pumptask.SourceSQLStatement := 'select top 100 * from TCardSource';
dts_pumptask.DestinationConnectionID := 2;
dts_pumptask.DestinationObjectName := 'TCardData';
//dts_pumptask.DestinationSQLStatement := 'select * from TCardData';
dts_step.Name := 'LowerCaseStep';
dts_step.TaskName := dts_pumptask.Name;
dts_step.ExecuteInMainThread := true;
dts_pumptask.ProgressRowCount := 100;
dts_pumptask.MaximumErrorCount := 0;
dts_pumptask.FetchBufferSize := 1;
dts_pumptask.UseFastLoad := true;
dts_pumptask.InsertCommitSize := 0;
dts_pumptask.ExceptionFileColumnDelimiter := '|';
dts_pumptask.ExceptionFileRowDelimiter := #13#10;
dts_pumptask.AllowIdentityInserts := false;
dts_pumptask.FirstRow := 0;
dts_pumptask.LastRow := 0;
dts_pumptask.FastLoadOptions := 2;
oCustomTask2_Trans_S1(dts_pumptask);
opckage.Tasks.Add(dts_task);
opckage.Steps.Add(dts_step);
opckage.Execute;
opckage.UnInitialize;
end;
执行后没有任何反应。请高手看看呀!
procedure oCustomTask2_Trans_S1(oCustomTask2: DataPumpTask2);
var
oTransformationOld: Transformation;
oTransformation: Transformation2;
begin
oTransformationOld := oCustomTask2.Transformations.New('DTS.DataPumpTransformCopy');
oTransformation := oTransformationOld as Transformation2;
oTransformation.Name := 'DirectCopyXform';
oTransformation.TransformFlags := 63;
oTransformation.ForceSourceBlobsBuffered := 0;
oTransformation.ForceBlobsInMemory := False;
oTransformation.InMemoryBlobSize := 1048576;
oTransformation.TransformPhases := 4;
oCustomTask2.Transformations.Add(oTransformation);
oTransformation := nil;
oTransformationOld := nil;
end;
var
opackageold : package;
opckage : package;
dts_conn, dts_conn2 : connection; //数据库的连接
dts_task : task;
dts_customtask : customtask;
dts_pumptask : datapumptask2;
dts_step : step;
begin
opackageold := Copackage.Create;
opckage := opackageold as package;
//opckage := Createoleobject('DTS.Package');
dts_conn := opckage.Connections.New('SQLOLEDB');
dts_conn2 := opckage.Connections.New('SQLOLEDB');
dts_conn.Catalog := 'db_pay';
dts_conn.ID := 1;
dts_conn.DataSource := 'bcj';
dts_conn.UserID := 'sa';
dts_conn.Password := '00';
//dts_conn.Reusable := true;
//dts_Conn.UseTrustedConnection := false;
//dts_conn.ConnectImmediate := false;
dts_conn2.Catalog := 'db_pay';
dts_conn2.ID := 2;
dts_conn2.DataSource := 'bcj';
dts_conn2.UserID := 'sa';
dts_conn2.Password := '00';
//dts_conn2.Reusable := true;
//dts_Conn2.UseTrustedConnection := false;
//dts_conn2.ConnectImmediate := false;
opckage.Connections.Add(dts_conn);
opckage.Connections.Add(dts_conn2);
dts_step := opckage.Steps.New;
dts_task := opckage.Tasks.New('DTSdatapumptask');
dts_task.Name := 'copy table';
dts_customtask := dts_task.CustomTask;
dts_pumptask := dts_customtask as datapumptask2;
dts_pumptask.Name := 'copy table';
dts_pumptask.SourceConnectionID := 1;
//dts_pumptask.sourceObjectName := 'TCardSoucesdfsdf';
dts_pumptask.SourceSQLStatement := 'select top 100 * from TCardSource';
dts_pumptask.DestinationConnectionID := 2;
dts_pumptask.DestinationObjectName := 'TCardData';
//dts_pumptask.DestinationSQLStatement := 'select * from TCardData';
dts_step.Name := 'LowerCaseStep';
dts_step.TaskName := dts_pumptask.Name;
dts_step.ExecuteInMainThread := true;
dts_pumptask.ProgressRowCount := 100;
dts_pumptask.MaximumErrorCount := 0;
dts_pumptask.FetchBufferSize := 1;
dts_pumptask.UseFastLoad := true;
dts_pumptask.InsertCommitSize := 0;
dts_pumptask.ExceptionFileColumnDelimiter := '|';
dts_pumptask.ExceptionFileRowDelimiter := #13#10;
dts_pumptask.AllowIdentityInserts := false;
dts_pumptask.FirstRow := 0;
dts_pumptask.LastRow := 0;
dts_pumptask.FastLoadOptions := 2;
oCustomTask2_Trans_S1(dts_pumptask);
opckage.Tasks.Add(dts_task);
opckage.Steps.Add(dts_step);
opckage.Execute;
opckage.UnInitialize;
end;
执行后没有任何反应。请高手看看呀!