10月 2006


编程技术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. 数据文件以 逗号分割

编程技术13 Oct 2006 10:32 am

Oracle数据库中跨库查询的连接语句

就是目前程序操作的是db1数据库,但由于某种原因,需要访问db2数据库里的表,连接如下

create database link dbLink
connect to USERID identified by PASSWORD
using ‘SID’;
/
select * from SID.tableName@dbLink;
/
drop database link dbLink;

编程技术08 Oct 2006 02:38 pm

            Dim objFileInfo As System.IO.FileInfo = New System.IO.FileInfo(strWinPath & strFileNm)

            If System.IO.File.Exists(strWinPath & strFileNm) Then
                Response.Clear()
                Response.ContentType = "application/octet-stream"
                Response.AddHeader("Content-Disposition", "attachment;  filename=" + objFileInfo.Name)
                Response.AddHeader("Content-Length", objFileInfo.Length.ToString())
                Response.WriteFile(objFileInfo.FullName)
                Response.Flush()
                Response.End()
            End If