K
kevin bailey
hi,
i am swamped by all the documentation and i can't find something relatively
simple.
a company has an intranet and they want a browser based application to
control data import/export. i need an apsx page to run dts packages on a
separate server.
after asking here and further investigation i am going to try this using
dtsrun.exe
which brings me to my question...
i can create a system.diagnostics.process object and run the program - but
how would i capture errors from this running.
the code i found is for VB and not ASP.NET and is at he end of this message.
when i tried to run it get Catch e As Win32Exception code produces Catch e
As Win32Exception.
where is a good place for ASP.NET examples?
thanks - kev
[Visual Basic]
Imports System
Imports System.Diagnostics
Imports System.ComponentModel
Namespace MyProcessSample
_
'/ <summary>
'/ Shell for the sample.
'/ </summary>
Public Class MyProcess
' These are the Win32 error code for file not found or access denied.
Private ERROR_FILE_NOT_FOUND As Integer = 2
Private ERROR_ACCESS_DENIED As Integer = 5
'/ <summary>
'/ Prints a file with a .doc extension.
'/ </summary>
Public Sub PrintDoc()
Dim myProcess As New Process()
Try
' Get the path that stores user documents.
Dim myDocumentsPath As String =
Environment.GetFolderPath(Environment.SpecialFolder.Personal)
myProcess.StartInfo.FileName = myDocumentsPath + "\MyFile.doc"
myProcess.StartInfo.Verb = "Print"
myProcess.StartInfo.CreateNoWindow = True
myProcess.Start()
Catch e As Win32Exception
If e.NativeErrorCode = ERROR_FILE_NOT_FOUND Then
Console.WriteLine((e.Message + ". Check the path."))
Else
If e.NativeErrorCode = ERROR_ACCESS_DENIED Then
' Note that if your word processor might generate
exceptions
' such as this, which are handled first.
Console.WriteLine((e.Message + ". You do not have
permission to print this file."))
End If
End If
End Try
End Sub 'PrintDoc
Public Shared Sub Main()
Dim myProcess As New MyProcess()
myProcess.PrintDoc()
End Sub 'Main
End Class 'MyProcess
End Namespace 'MyProcessSample
i am swamped by all the documentation and i can't find something relatively
simple.
a company has an intranet and they want a browser based application to
control data import/export. i need an apsx page to run dts packages on a
separate server.
after asking here and further investigation i am going to try this using
dtsrun.exe
which brings me to my question...
i can create a system.diagnostics.process object and run the program - but
how would i capture errors from this running.
the code i found is for VB and not ASP.NET and is at he end of this message.
when i tried to run it get Catch e As Win32Exception code produces Catch e
As Win32Exception.
where is a good place for ASP.NET examples?
thanks - kev
[Visual Basic]
Imports System
Imports System.Diagnostics
Imports System.ComponentModel
Namespace MyProcessSample
_
'/ <summary>
'/ Shell for the sample.
'/ </summary>
Public Class MyProcess
' These are the Win32 error code for file not found or access denied.
Private ERROR_FILE_NOT_FOUND As Integer = 2
Private ERROR_ACCESS_DENIED As Integer = 5
'/ <summary>
'/ Prints a file with a .doc extension.
'/ </summary>
Public Sub PrintDoc()
Dim myProcess As New Process()
Try
' Get the path that stores user documents.
Dim myDocumentsPath As String =
Environment.GetFolderPath(Environment.SpecialFolder.Personal)
myProcess.StartInfo.FileName = myDocumentsPath + "\MyFile.doc"
myProcess.StartInfo.Verb = "Print"
myProcess.StartInfo.CreateNoWindow = True
myProcess.Start()
Catch e As Win32Exception
If e.NativeErrorCode = ERROR_FILE_NOT_FOUND Then
Console.WriteLine((e.Message + ". Check the path."))
Else
If e.NativeErrorCode = ERROR_ACCESS_DENIED Then
' Note that if your word processor might generate
exceptions
' such as this, which are handled first.
Console.WriteLine((e.Message + ". You do not have
permission to print this file."))
End If
End If
End Try
End Sub 'PrintDoc
Public Shared Sub Main()
Dim myProcess As New MyProcess()
myProcess.PrintDoc()
End Sub 'Main
End Class 'MyProcess
End Namespace 'MyProcessSample