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 
  • 相关阅读:
    自定义镜像流程
    go语言中go+select的理解
    go语言中var声明chan、map、指针,注意的情况
    docker SDK 的基本学习
    ubuntu上安装postgres以及在远程连接上的坑
    go语言模板中的os.Stdout标准输出转化为string
    angular7升级到angular8
    sudo不用在输入密码
    go语言简单的执行shell命令
    Ubuntu上面安装docker
  • 原文地址:https://www.cnblogs.com/yg_zhang/p/1313911.html
Copyright © 2011-2022 走看看