VB converting SSIS Variable to String

  • Thread starter Thread starter Bihon noro
  • Start date Start date
B

Bihon noro

Guest
Hi All,


Please help ! I am tring to convert SSIS variable to string but it keep thruing. any help appreciated

The code that is throwing error is laPath = Convert.ToString(Dts.Variables["User::SourcePath"].Value)


Public Sub Main()
'
Dim oMissing As Object = System.Reflection.Missing.Value
Dim xl As New ApplicationClass()
Dim xlBook As Microsoft.Office.Interop.Excel.Workbook
Dim xlSheet As Worksheet
Dim laPath As String

laPath = Convert.ToString(Dts.Variables["User::SourcePath"].Value)


xlBook = DirectCast(xl.Workbooks.Open(laPath, oMissing, oMissing, oMissing, oMissing, oMissing,
oMissing, oMissing, oMissing, oMissing, oMissing, oMissing,
oMissing, oMissing, oMissing), Workbook)

xlSheet = DirectCast(xlBook.Worksheets.Item(1), Worksheet)
xlSheet.Name = "CIAOxxx"
xlBook.Save()
xl.Application.Workbooks.Close()
'
Dts.TaskResult = ScriptResults.Success
End Sub

#Region "ScriptResults declaration"
'This enum provides a convenient shorthand within the scope of this class for setting the
'result of the script.

'This code was generated automatically.
Enum ScriptResults
Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success
Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
End Enum

#End Region

End Class


Thanks

Continue reading...
 
Back
Top