February 18, 2014 at 9:57 am
Hi all,
I'm getting this message when I hover over a new Script task (C# + 2008) which checks for the existance of a file , but the only alterations I have made to the script are...
Using System.IO
...as well as...
Dts.Variables ["FileExists"].Value = File.Exists(Dts.Variables ["FileLocation"].Value.ToString());
I have already set 'DelayValidation' to true, but no luck.
February 18, 2014 at 12:28 pm
What happens when you build the script component[/url]?
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
February 18, 2014 at 12:35 pm
99% of the time this is a syntax error.
I don't use C#, I use VB.NET, but DTS.Variables("VariableName").value.ToString() is usually how it's written, not with [].
Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.
For better assistance in answering your questions[/url] | Forum Netiquette
For index/tuning help, follow these directions.[/url] |Tally Tables[/url]
Twitter: @AnyWayDBA
February 18, 2014 at 12:42 pm
Evil Kraig F (2/18/2014)
I don't use C#, I use VB.NET, ...
There's one in every family...
:hehe:
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
February 19, 2014 at 2:22 am
Error1; expectedC:\Users\BubblesA\AppData\Local\Temp\\SSIS\2cf9337495804a85b10c6d286ada294c\ScriptMain.cs1016
st_04c9a6a3068e41a3ab44a1a18872b650
Error2Resource file "Properties\Resources.resx" cannot be found.st_04c9a6a3068e41a3ab44a1a18872b650
Error3Non-invocable member 'Microsoft.SqlServer.Dts.Tasks.ScriptTask.ScriptObjectModel.Variables' cannot be used like a method.C:
\Users\BubblesA\AppData\Local\Temp\1\SSIS\2cf9337495804a85b10c6d286ada294c\ScriptMain.cs4717st_04c9a6a3068e41a3ab44a1a18872b650
Error4'Microsoft.SqlServer.Dts.Tasks.ScriptTask.ScriptObjectModel' does not contain a definition for 'variables' and no extension method
'variables' accepting a first argument of type 'Microsoft.SqlServer.Dts.Tasks.ScriptTask.ScriptObjectModel' could be found (are you missing a using directive or an assembly reference?)C:\Users\BubblesA\AppData\Local\Temp\1\SSIS\2cf9337495804a85b10c6d286ada294c\ScriptMain.cs4766
st_04c9a6a3068e41a3ab44a1a18872b650
Kraig - I've tried using both standard brackets ie (), and curly braces {}, both threw back errors, but the square brackets [] threw back the least.
February 19, 2014 at 2:49 am
Just checked it, the syntax is like this:
Dts.Variables["User::MyVariable"].Value.ToString()
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
February 19, 2014 at 4:20 am
YAYYYYYYYYYYYYYYYYYYY!!!! The small red cross is gone!! You don't know how big a pain in the neck that was for me yesterday!!!
You can have a few drinks at the bar on my tab tonight mate!! 🙂
One small thing...towards the top of the script, I've put "Using System.IO", which is consistent with the rest of the script, however all the online examples use, "ImportSystem.IO".
Will this make any difference at runtime??
Thanks profusely again Koen!!
February 19, 2014 at 4:29 am
I use using as well.
I think it doesn't make a difference:
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply