Hi guys,
I have an SSIS package the contains a script component. However, each time I run the package the script component throws an error on first attempt but if I run it the second time, it will run successfully.
Here is the error i get and my code:
{
base.PreExecute();
/*
* Add your code here
*/
}
/// <summary>
/// This method is called after all the rows have passed through this component.
///
/// You can delete this method if you don't need to do anything here.
/// </summary>
public override void PostExecute()
{
base.PostExecute();
/*
* Add your code here
*/
}
public override void CreateNewOutputRows()
{
/*
Add rows by calling the AddRow method on the member variable named "<Output Name>Buffer".
For example, call MyOutputBuffer.AddRow() if your output was named "MyOutput".
*/
string datexl = Variables.Datexl;
string url = Variables.FileUrl;
string result = ParseFile(url, datexl);
TransactionVolumeBuffer.AddRow();
TransactionVolumeBuffer.VolumeProcessed = result;
}
static string ParseFile(string fPath, string datexl)
{
bool inParentGroup = false, inGroup = false, inRow = false;
if (!File.Exists(fPath)) return "";
string[] allText = File.ReadAllLines(fPath);
string finalVAl = "";
foreach (string txt in allText)
{
if (inParentGroup && inGroup && inRow)
{
string TXT = txt.Trim();
// TXT = "<td width=\"70%\"><font size=\"1\"><span class=\"property\">6613875</span></font></td>";
var sss = TXT.Split('>').ToArray();
foreach (string myz in sss)
{
string checker = myz.Trim();
var first = checker[0];
if (first != '<')
{
finalVAl = checker.Remove(checker.IndexOf("<"));
return finalVAl.Replace(" ", "");
}
}
}
if (inParentGroup && inGroup && txt.Contains(datexl))
{
inRow = true;
}
if (inParentGroup && txt.Contains("Transaction volume history"))
{
inGroup = true;
}
if (txt.Contains("Statistics"))
{
inParentGroup = true;
}
}
return "";
}
}
me