编程技术13 Oct 2006 10:43 am

asp.net调用bat和ctl文件实现sql*loader的功能

1  后台调用bat文件

            Dim proc As System.Diagnostics.Process
            proc = System.Diagnostics.Process.Start("cmd.exe", " /c " & "D:\execise\SE004.bat")
            proc.WaitForExit()
  或者

        Shell("cmd.exe /c D:\execise\SE004.bat", AppWinStyle.NormalFocus)

 或者

             Dim p As New System.Diagnostics.Process
            ‘p.StartInfo.FileName = "cmd.exe"
            ‘p.StartInfo.Arguments = " /c " & "D:\execise\SE004.bat"
            ‘p.StartInfo.UseShellExecute = False
            ‘p.StartInfo.RedirectStandardInput = True
            ‘p.StartInfo.RedirectStandardOutput = True
            ‘p.StartInfo.RedirectStandardError = True
            ‘p.StartInfo.CreateNoWindow = False
            ‘p.Start()

            ‘Dim strValue As String = p.StandardOutput.ReadToEnd()

2  然后调用ctl文件,bat文件的

    SQLLDR USERID=spv3/paper@san CONTROL=d:\execise\SE004.CTL log=D:\execise\LOG\SE004.log

3, ctl文件的内容如下

   

LOAD DATA
INFILE ‘D:\execise\SE004.CSV’
TRUNCATE
INTO TABLE TEMP_tableName
FIELDS TERMINATED BY ","
TRAILING NULLCOLS
(
id

,age

,num

,sum

)

4. 数据文件以 逗号分割

One Response to “asp.net调用bat和ctl文件实现sql*loader的功能”

  1. on 18 Oct 2006 at 21:09 数据恢复

    谢谢

Trackback this Post | Feed on comments to this Post

Leave a Reply