May 28, 2014 at 1:12 am
Hi,
Newbie here regarding SSIS. I have a package that will check if a file exists in a folder. The user I use to run the SSIS is domain admin (I have added permissions for the disk, folder and file to the user).
When debugging the package, it always default to false (no file exists).
What have I missed here?
Regards
H
May 28, 2014 at 1:20 am
hristo1977 (5/28/2014)
Hi,Newbie here regarding SSIS. I have a package that will check if a file exists in a folder. The user I use to run the SSIS is domain admin (I have added permissions for the disk, folder and file to the user).
When debugging the package, it always default to false (no file exists).
What have I missed here?
Regards
H
Please provide details of how you are performing the existence check.
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
May 28, 2014 at 1:35 am
Hi,
public void Main()
{
string filelocation = @"D:\myfolder\emps.txt";
if (File.Exists(filelocation) == true)
{
Dts.Variables["FileExits"].Value = true;
}
else
{
Dts.Variables["FileExits"].Value = false;
}
Dts.TaskResult = (int)ScriptResults.Success;
}
FileExits is a variable with the default value of FALSE.
Regards
H
May 28, 2014 at 1:43 am
OK. are you debugging the actual script execution using breakpoints? Just to double-check the logic.
How are you inspecting the value of the variable?
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
May 28, 2014 at 1:47 am
Hi,
Well, I have tried. But when I set a break point and run debugging the VS software is always starting up (even though its already running). Is that normal?
Regards
H
May 28, 2014 at 1:53 am
hristo1977 (5/28/2014)
Hi,Well, I have tried. But when I set a break point and run debugging the VS software is always starting up (even though its already running). Is that normal?
Regards
H
It creates a separate debug session, if that's what you mean.
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
May 28, 2014 at 2:42 am
Ok, so I select "recent project" and then nothing happens. Execept that the projects load up again. And if I add the breakpoint again, the VS starts up again.
Regards
H
May 28, 2014 at 2:46 am
That's not right.
After setting a breakpoint in your code, close the code window.
At the package control flow, click on the execute icon. When the flow reaches the breakpoint, a VS debug window should open to allow you to step through your code.
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
May 28, 2014 at 2:47 am
Quick thought, escaped back-slashes?
😎
public void Main()
{
string filelocation = @"D:\\myfolder\\emps.txt";
if (File.Exists(filelocation) == true)
{
Dts.Variables["FileExits"].Value = true;
}
else
{
Dts.Variables["FileExits"].Value = false;
}
Dts.TaskResult = (int)ScriptResults.Success;
}
May 28, 2014 at 2:59 am
Quick thought, escaped back-slashes?
Preceding the string with the @ avoids the need for that.
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
May 28, 2014 at 3:16 am
Well, maybe this is the problem:
Warning: Cannot debug script tasks when running under the 64 bit version of the Integration Services runtime.
Is there a way round this, install 32bits IS runtime?
Regards
H
May 28, 2014 at 3:21 am
Check the project properties under debugging and set 'Run 64 Bit Runtime' to false. Then try again.
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
May 28, 2014 at 5:10 am
Ok, that worked, I can now debug my little code. I can see that the path is correct, but File.Exists never sets to TRUE.
Is there a way to see if a really have the right access?
Regads
H
May 28, 2014 at 5:33 am
Another quick though:-D (and you could squash two bugs with the same code), check the file size. Found this lying around:cool:
Private Function intGetFileSize(ByVal strFileName As String) As Integer
Dim f As IO.FileInfo = New System.IO.FileInfo(strFileName)
intGetFileSize = f.Length()
End Function
May 28, 2014 at 5:46 am
Hi,
Thanks for that. I got quite a few errors when pasting in that, do I miss a namespace?
using System;
using System.Data;
using Microsoft.SqlServer.Dts.Runtime;
using System.Windows.Forms;
using System.IO;
Regards
H
Viewing 15 posts - 1 through 15 (of 22 total)
You must be logged in to reply to this topic. Login to reply