Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
bob12
Starting Member
8 Posts |
Posted - 2010-08-19 : 12:23:23
|
I am doing this in script task. Here is my code. This step is successfull but not doing anything. Can some one help me?Imports SystemImports System.DataImports System.MathImports Microsoft.SqlServer.Dts.RuntimeImports Microsoft.SqlServer.Dts.Pipeline.WrapperImports Microsoft.SqlServer.Dts.Runtime.WrapperImports Microsoft.VisualBasic.FileIO.FileSystemImports System.IO.FileSystemInfoImports System.IOImports System.NetPublic Class ScriptMain' The execution engine calls this method when the task executes.' To access the object model, use the Dts object. Connections, variables, events,' and logging features are available as static members of the Dts class.' Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.' ' To open Code and Text Editor Help, press F1.' To open Object Browser, press Ctrl+Alt+J.Private Declare Function InternetCloseHandle Lib "wininet.dll" (ByVal HINet As Integer) As IntegerPrivate Declare Function InternetOpen Lib "wininet.dll" Alias "InternetOpenA" (ByVal sAgent As String, ByVal lAccessType As Integer, ByVal sProxyName As String, ByVal sProxyBypass As String, ByVal lFlags As Integer) As IntegerPrivate Declare Function InternetConnect Lib "wininet.dll" Alias "InternetConnectA" (ByVal hInternetSession As Integer, ByVal sServerName As String, ByVal nServerPort As Integer, ByVal sUsername As String, ByVal sPassword As String, ByVal lService As Integer, ByVal lFlags As Integer, ByVal lContext As Integer) As IntegerPrivate Declare Function FtpRenameFile Lib "wininet.dll" Alias "FtpRenameFileA" (ByVal hFtpSession As Integer, ByVal lpszExisting As String, ByVal lpszNew As String) As BooleanPublic Sub Main()Dim INet, INetConn As IntegerDim RC As BooleanINet = InternetOpen("MyFTP Control", 1, vbNullString, vbNullString, 0)INetConn = InternetConnect(INet, "testserver", 0, "username", "password", 1, 0, 0)MsgBox(INetConn)RC = FtpRenameFile(INetConn, "\\inetdir\input.txt", "input.hl7") ' want to move to root directoryInternetCloseHandle(INetConn)InternetCloseHandle(INet)Dts.TaskResult = Dts.Results.SuccessEnd SubEnd ClassThank You |
|
slimt_slimt
Aged Yak Warrior
746 Posts |
Posted - 2010-08-19 : 15:42:22
|
you can easily do this using SSIS elements. Use FTP Task (transfer file) and File Task (to rename it, to copy it) |
|
|
|
|
|
|
|