ASP and DTS Packages

T

tfs

I am having a problem with executing DTS packages on my clients
machine. The exact same code (except for the Server Name) and
packages work fine on my machine.

We are running Sql Server 2000 and ASP.Net 1.1. When you look at my
code you will see a few lines that will all be commented out but 1
where I am setting sqlString to the code I want to execute. I find
that on my client machine the same code will execute a stored
procedure(as long as the stored procedure doesn't execute a package)
as well as a select statement just fine.

We seem to get 2 errors that doesn't tell me much

1. This error tells me there is a severe error, but not what is
happening. It is alway on the objCommand.ExecuteReader call. I have
tried running it with the objCommand.prepare executing or commented
out with the same problems.

""A severe error occurred on the current command. The results, if
any, should be discarded."

2. This one will have a different handle each time it comes up.

"Could not find prepared statement with handle 3."

Here is the code I am using. TestPackage is a package with nothing
but ActiveX code that only does x=x+1.

Package 2 is a Stored procedure that calles TestPackage. Package 4 is
a stored procedure (which works) that only does a Print statement.

Sub execPackage()

dim sqlString as string
dim sResults as String

Dim objConnect as SqlConnection = new
SqlConnection(System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_Contour_Server"))
objConnect.Open()

' sqlString = "exec master.dbo.xp_cmdshell 'dtsrun /S "
& chr(34) & "OPENWORX" &
chr(34) & " /N " & chr(34) &
"TestPackage" & " /E "
sqlString = "exec ExecPackage5 '" & "a test"
& "'"
' sqlString = "exec ExecPackage2 '" &
request.QueryString("name") & "'"
' sqlString = "select * from holidays"

' sqlString = "exec master.dbo.xp_cmdshell 'dtsrun /S "
& chr(34) & "OPENWORX" &
chr(34) & " /N " & chr(34) &
"TestPackage" & chr(34) & " /E
'"
' sqlString = "exec master.dbo.xp_cmdshell 'dtsrun /S "
& chr(34) & "OPENWORX" &
chr(34) & " /N " & chr(34) &
request.QueryString("name") & chr(34)
& " /E '"
' sqlString = "exec master.dbo.xp_cmdshell
'c:\dtstask.cmd'"
' sqlString = "exec ExecPackage4 '" & "a test"
& "'"

response.Write(sqlString)
trace.warn(sqlString)

Dim objCommand as SqlCommand = new SqlCommand(sqlString,
objConnect)
' objCommand.Prepare()

Dim objDataReader as SqlDataReader = objCommand.ExecuteReader( _
CommandBehavior.CloseConnection)

dim ktr as integer

ktr = 0

while (objDataReader.Read() = true)
if(objDataReader(0) is System.DBNull.value) then
sResults = ""
else
sResults = objDataReader(0)
end if
results.text = results.text & sResults & vbCrLf
ktr = ktr + 1
end while

results.text = results.text & "at end of loop ktr = "
& ktr & vbCrLf

objDataReader.Close()
objCommand.Dispose()
objConnect.Close()

end sub


I know the code works as it works fine on my servers.

Thanks,

Tom
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top