Sql Server JOb Execution problem at the time of FTP

  •  

    I am trying to automate upload task at midnight. For this I have create file which generate TAB delimited file, then I create a FTP connection file and thne execute this ftp script for upload the file, but file is still not uploading to FTP server. If I Upload file manually, file uploded succcessfully.

    Can any of the guru tell me whats wrong I am doing here?

    --------Code Start here

    Function Main()

    Dim fs

    Dim txt

    Dim objFSO, objMyFile, objShell, strFTPScriptFileName, strFile2Get

    Dim strLocalFolderName, strFTPServerName, strLoginID

    Dim strPassword, strFTPServerFolder

    strupload=""

    strupload=Strupload &  "product_url" & VbTab & "name" & VbTab & "description" & VbTab & "price" & VbTab & "image_url" & VbTab & "category" & VbTab &

    "offer_id" & VbCrLF

    dim strConn

    strConn="driver={SQL Server};server=localserver;Persist Security Info = False;uid=sa;pwd=;database=localserver"

    Set conn=CreateObject("ADODB.Connection")

    conn.Open strConn

    set rs = CreateObject("ADODB.Recordset")

    rs.open "SELECT top 10 * FROM items where web_active= 'T'", conn, 1, 3

    do while rs.eof<>True

        strupload=Strupload &  "http://localserver/evp/itemdc.asp?ic=" & Rs("itemno") & VbTab

      strupload=Strupload &  Rs("descript") & VbTab

      Dim mDescript

      mDescript = Rs("webDesc")

      mDescript = Replace(mDescript,"<br>","")

     

      strupload=Strupload &  mDescript & VbTab

      strupload=Strupload &  Rs("sellpric") & VbTab

      strupload=Strupload &  "http://localserver/mmPARKDEVP/Images/" & Rs("itemno") & ".jpg" & VbTab

      strupload=Strupload &  "Furniture" & VbTab

      strupload=Strupload & Rs("itemno") & VbTab

      strupload=Strupload & VbCrLF

      rs.movenext

    loop

    Set fs = CreateObject("Scripting.FileSystemObject")

    Set txt = fs.CreateTextFile("C:\" & "upload.txt", TRUE)

    txt.Write strFroogle

    txt.Close

    Set txt = Nothing

    Set fs = Nothing

    rs.close

    set rs=Nothing

    conn.Close

    set conn=Nothing

    'Customize code here to fit your needs

    strLocalFolderName = "c:\"

    strFTPServerName = IP Address

    strLoginID = "administrator"

    strPassword = "nopass1"

    strFTPServerFolder = ""

    'The follow lines of code generate the FTP script file on the fly,

    'because the get file name changes every day

    strFTPScriptFileName = strLocalFolderName & "uploadftp.txt"

    Set objFSO = CreateObject("Scripting.FileSystemObject")

    If (objFSO.FileExists(strFTPScriptFileName)) Then

        objFSO.DeleteFile (strFTPScriptFileName)

    End If

    Set objMyFile = objFSO.CreateTextFile(strFTPScriptFileName, True)

    objMyFile.WriteLine ("open " & strFTPServerName)

    objMyFile.WriteLine (strLoginID)

    objMyFile.WriteLine (strPassword)

    objMyFile.WriteLine ("cd " & strFTPServerFolder)

    objMyFile.WriteLine ("ascii")

    objMyFile.WriteLine ("lcd " & strLocalFolderName)

    objMyFile.WriteLine ("put " & "upload.txt")

    objMyFile.WriteLine ("bye")

    objMyFile.Close

    Set objShell = CreateObject("WScript.Shell")

    objShell.Run ("ftp -s:" & chr(34) & strFTPScriptFileName & chr(34))

    Set objShell = Nothing

    Set objFSO = Nothing

    Set objMyFile = Nothing

    End Function

    ------------- Code Ends Here

  • This was removed by the editor as SPAM

  • This appears to have been resolved under the following post

    http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=9&messageid=227036

     

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply