Response.Buffer and Resonse.Flush


B

Brian

I'm trying to execute a DTS package through an ASP.Net web page. I want it
to output the successful completion of each step. I have pasted my code
below. It executes and output what I want, but only when the DTS has
finished executing.

Please help...

Dim oPackage As New DTS.Package

Dim oStep As DTS.Step

Dim oRow As TableRow, oCell(1) As TableCell

Dim lErr As Long, sSource As String, sDesc As String

' Load Package

oPackage.LoadFromSQLServer(mServer, mUsername, mPassword, 0,
mDTSOwnerPassword, , , vDTSPackageName)

' Set Exec on Main Thread

For Each oStep In oPackage.Steps

oStep.ExecuteInMainThread = True

Next

' Execute

oPackage.Execute()

oRow = New TableRow

oCell(0) = New TableCell

oCell(1) = New TableCell

oRow.CssClass = "Heading"

oCell(0).Width = Unit.Pixel(250)

oCell(0).Text = "Step Description"

oCell(1).Width = Unit.Pixel(350)

oCell(1).Text = "Execution Status"

oRow.Cells.AddRange(oCell)

pTable.Rows.Add(oRow)

' Get Status and Error Message

For Each oStep In oPackage.Steps

If oStep.ExecutionResult = 1 Then

oRow = New TableRow

oCell(0) = New TableCell

oCell(1) = New TableCell

oStep.GetExecutionErrorInfo(lErr, sSource, sDesc)

oCell(0).Width = Unit.Pixel(250)

oCell(0).Text = oStep.Description

oCell(0).VerticalAlign = VerticalAlign.Top

oCell(1).Width = Unit.Pixel(350)

oCell(1).CssClass = "Red"

oCell(1).VerticalAlign = VerticalAlign.Top

If lErr = 0 Then

oCell(1).Text = "Failed"

Else

oCell(1).Text = "Failed<br>Error: " & lErr & "<br>Source: " & sSource &
"<br>Description: " & sDesc

End If

oRow.Cells.AddRange(oCell)

pTable.Rows.Add(oRow)

Else

oRow = New TableRow

oCell(0) = New TableCell

oCell(1) = New TableCell

oCell(0).Width = Unit.Pixel(250)

oCell(0).Text = oStep.Description

oCell(1).Width = Unit.Pixel(350)

oCell(1).Text = "Succeeded"

oRow.Cells.AddRange(oCell)

pTable.Rows.Add(oRow)

End If

Next

oPackage.UnInitialize()

oStep = Nothing

oPackage = Nothing
 
Ad

Advertisements

S

Scott M.

Response.Flush() allows whatever is in the "Response.Buffer" to flow down to
the client and then being buffering again. I don't see anything in your
code that is trying to send anything to the client, so there would not be
anything in the buffer based on the code below. Nothing in the buffer =
nothing to flush.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top