dbTalk Databases Forums  

Permission Denied when Deleting a file using Active X Script

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Permission Denied when Deleting a file using Active X Script in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Dorsa
 
Posts: n/a

Default Permission Denied when Deleting a file using Active X Script - 02-19-2004 , 01:11 PM






I have read some other articles regardimg this problem but still I
could not fix the problem.

My DTS package has 5 different Steps which is at first step I have a
ActiveXScript ruuning. It takes an excel file (testfile.xls) in the
server, copies that file to another folder with Today's Date. Then
Renames it to "test.xls" . Then in Step2 I have a connection that take
that excel file "test.xls" and Imports it to database.
at the last step I have another ActiveXScript which I need to delete
that file "test.xls" . When it gets to the step5: I get the permission
Denied. I think the file is still open! (not sure)
But when I run it seperatly it runs successfully.

I have tried to check the workflow/Close the connection when
compleption. ( not sure in which connection I should do that but I
think I have tried it for all Steps)
Could you give me solution for that.
Thanks
Here is my Script
'************************************************* *********************
' Visual Basic ActiveX Script
'************************************************* ***********************

Function Main()

Dim TemplateDest
Dim EmailfileDest
Dim today


today = Year(Date) & "-" & Right("0" & Month(Date), 2) & "-" &
Right("0" & Day(Date), 2)


Set fso1 = CreateObject("Scripting.FileSystemObject")

fso1.copyfile TemplateDest, EmailfileDest & today + "-" &
"EventDelinquenciesConflictsReport" & ".xls"


fso1. DeleteFile ("somewhere..\Reporting\Delinquency
Reports\AutomateDaily\EventNotification.xls")

Main = DTSTaskExecResult_Success

End Function

Reply With Quote
  #2  
Old   
K
 
Posts: n/a

Default RE: Permission Denied when Deleting a file using Active X Script - 02-19-2004 , 02:26 PM






check option "execute package in main thread" and "close connection on completion

----- Dorsa wrote: ----

I have read some other articles regardimg this problem but still
could not fix the problem

My DTS package has 5 different Steps which is at first step I have
ActiveXScript ruuning. It takes an excel file (testfile.xls) in th
server, copies that file to another folder with Today's Date. The
Renames it to "test.xls" . Then in Step2 I have a connection that tak
that excel file "test.xls" and Imports it to database
at the last step I have another ActiveXScript which I need to delet
that file "test.xls" . When it gets to the step5: I get the permissio
Denied. I think the file is still open! (not sure
But when I run it seperatly it runs successfully.

I have tried to check the workflow/Close the connection whe
compleption. ( not sure in which connection I should do that but
think I have tried it for all Steps
Could you give me solution for that
Thank
Here is my Scrip
'************************************************* ********************
' Visual Basic ActiveX Scrip
'************************************************* **********************

Function Main(

Dim TemplateDes
Dim EmailfileDest
Dim toda


today = Year(Date) & "-" & Right("0" & Month(Date), 2) & "-"
Right("0" & Day(Date), 2


Set fso1 = CreateObject("Scripting.FileSystemObject"

fso1.copyfile TemplateDest, EmailfileDest & today + "-"
"EventDelinquenciesConflictsReport" & ".xls


fso1. DeleteFile ("somewhere..\Reporting\Delinquenc
Reports\AutomateDaily\EventNotification.xls"

Main = DTSTaskExecResult_Succes

End Function

Reply With Quote
  #3  
Old   
Dorsa
 
Posts: n/a

Default Re: Permission Denied when Deleting a file using Active X Script - 02-19-2004 , 07:56 PM



I have tried that before but no success. any other idea?



"K" <anonymous (AT) discussions (DOT) microsoft.com> wrote

Quote:
check option "execute package in main thread" and "close connection on completion"

----- Dorsa wrote: -----

I have read some other articles regardimg this problem but still I
could not fix the problem.

My DTS package has 5 different Steps which is at first step I have a
ActiveXScript ruuning. It takes an excel file (testfile.xls) in the
server, copies that file to another folder with Today's Date. Then
Renames it to "test.xls" . Then in Step2 I have a connection that take
that excel file "test.xls" and Imports it to database.
at the last step I have another ActiveXScript which I need to delete
that file "test.xls" . When it gets to the step5: I get the permission
Denied. I think the file is still open! (not sure)
But when I run it seperatly it runs successfully.

I have tried to check the workflow/Close the connection when
compleption. ( not sure in which connection I should do that but I
think I have tried it for all Steps)
Could you give me solution for that.
Thanks
Here is my Script
'************************************************* *********************
' Visual Basic ActiveX Script
'************************************************* ***********************

Function Main()

Dim TemplateDest
Dim EmailfileDest
Dim today


today = Year(Date) & "-" & Right("0" & Month(Date), 2) & "-" &
Right("0" & Day(Date), 2)


Set fso1 = CreateObject("Scripting.FileSystemObject")

fso1.copyfile TemplateDest, EmailfileDest & today + "-" &
"EventDelinquenciesConflictsReport" & ".xls"


fso1. DeleteFile ("somewhere..\Reporting\Delinquency
Reports\AutomateDaily\EventNotification.xls")

Main = DTSTaskExecResult_Success

End Function

Reply With Quote
  #4  
Old   
Russel Loski, MCSD
 
Posts: n/a

Default Re: Permission Denied when Deleting a file using Active X Script - 02-19-2004 , 09:36 PM



You don't say which step you close the connection on. I have a couple thoughts. Which is the last step before you run your activex script that uses a connection to the excel spreadsheet? Have you set the workflow/close the connection property in that step?

Russ

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.