zoukankan      html  css  js  c++  java
  • SSIS 脚本任务读取文件

    变量fileName输入参数,读取文件内容放到变量content中。

     1 Public Sub Main()
     2         '
     3         ' Add your code here
     4         '
     5         Dim filename As String
     6         Dim content As StringBuilder
     7         content = New StringBuilder
     8         filename = Dts.Variables("fileName").Value.ToString()
     9 
    10         Try
    11             ' Create an instance of StreamReader to read from a file.
    12             Using sr As StreamReader = New StreamReader(filename)
    13                 Dim line As String
    14              
    15                 Do
    16                     line = sr.ReadLine()
    17                     content.AppendLine(line)
    18                 Loop Until line Is Nothing
    19                 sr.Close()
    20 
    21             End Using
    22 
    23             Dts.Variables("content").Value = content.ToString()
    24 
    25         Catch E As Exception
    26           
    27             Console.WriteLine(E.Message)
    28         End Try
    29 
    30 
    31 
    32         Dts.TaskResult = Dts.Results.Success
    33     End Sub
    34 
    35 
  • 相关阅读:
    字符串通配
    最短排序
    最长回文子串
    添加回文串
    找零钱
    最优编辑
    01背包
    PHP做分页查询(查询结果也显示为分页)
    PHP 练习3:租房子
    Html5学习3(拖放、Video(视频)、Input类型(color、datetime、email、month 、number 、range 、search、Tel、time、url、week ))
  • 原文地址:https://www.cnblogs.com/yg_zhang/p/1313911.html
Copyright © 2011-2022 走看看