Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
SQL Server DTS Discussion specific to Data Transformation Service with SQL Server. General SQL Server discussions should use the general SQL Server forum. Readers of the book Professional SQL Server 2000 DTS with questions specific to that book should post in that book forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server DTS section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 29th, 2004, 02:37 PM
Friend of Wrox
 
Join Date: Nov 2003
Location: Lehigh Acres, FL, USA.
Posts: 625
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jemacc
Default File size Scripts

Hello Everyone I have a script from sqldts.com in I will like to use to check a file size.
'************************************************* *********************
' Visual Basic ActiveX Script
'************************************************* ***********************
' File Size
Option Explicit

Function Main()

    Dim oFSO
    Dim oFile
    Dim sSourceFile

    Set oFSO = CreateObject("Scripting.FileSystemObject")

    sSourceFile = DTSGlobalVariables("SourceFileName").Value

    Set oFile = oFSO.GetFile(sSourceFile)

    If oFile.Size > 0 Then
        Main = DTSTaskExecResult_Success
    Else
        Main = DTSTaskExecResult_Failure
    End If

    ' Clean Up
    Set oFile = Nothing
    Set oFSO = Nothing
End Function

The Global Vairiable for 'SourceFileName'=\\myserver\C$\inetpub\ftprootfor 'sourceFile'=\\myserver\C$\inetpub\ftproot\upfile

I receive error description: error code=0
          error source: Microsoft VBSCRIPT Run Time Error
          error description :Invalid procedure call or argument

          Error code 16

Can anybody help with these errors or check for format


__________________
Jaime E. Maccou
 
Old June 29th, 2004, 09:19 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

What line is the error on?

Brian
 
Old June 29th, 2004, 11:20 PM
Friend of Wrox
 
Join Date: Nov 2003
Location: Lehigh Acres, FL, USA.
Posts: 625
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jemacc
Default

The error is on this line: Set oFile = oFSO.GetFile(sSourceFile)

 
Old July 18th, 2004, 02:32 PM
Friend of Wrox
 
Join Date: Nov 2003
Location: Lehigh Acres, FL, USA.
Posts: 625
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jemacc
Default

I found an answer

'************************************************* *********************
' Visual Basic ActiveX Script
'************************************************* ***********************
' File Size
Option Explicit

Function Main()

    Dim oFSO
    Dim oFile
    Dim sSourceFile

    Set oFSO = CreateObject("Scripting.FileSystemObject")

    sSourceFile = DTSGlobalVariables("SourceFileName").Value

    Set oFile = oFSO.GetFile(sSourceFile)

    If oFile.Size > 0 Then
        Main = DTSTaskExecResult_Success
    Else
        Main = DTSTaskExecResult_Failure
    End If

    ' Clean Up
    Set oFile = Nothing
    Set oFSO = Nothing
End Function

I changed this section
Function Main()

    Dim oFSO
    Dim oFile
    Dim sSourceFile

    Set oFSO = CreateObject("Scripting.FileSystemObject")

    sSourceFile = DTSGlobalVariables("SourceFileName").Value

    Set oFile = oFSO.GetFile(sSourceFile)

    If oFile.Size > 0 Then
        Main = DTSTaskExecResult_Success
    Else
        Main = DTSTaskExecResult_Failure
    End If

to this
Function Main()
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile("\\myserver\C$\inetpub\ftproot\upfi le")

If objFile.Size >0 Then
main = DTSTaskExecResult_success
else
main = DTSTaskExecResult_failure
end if
End Function






Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get file size from VB? delcyan VB How-To 8 April 9th, 2010 04:52 PM
Wrox File Share - 1g file size limit b67 BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 3 May 7th, 2007 04:24 PM
file size dotnetprogrammer VS.NET 2002/2003 3 November 17th, 2004 01:33 AM
Trouble with file size, PLEASE HELP!!! brettk_1 ASP.NET 1.0 and 1.1 Professional 3 August 25th, 2004 07:41 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.