开发者

How to run command SQLLoader Oracle in c#

开发者 https://www.devze.com 2023-02-16 11:55 出处:网络
How to run command SQLLoader Oracle in c#. I try my sourcode for run this SQLLoader, but nothing happen and er开发者_开发问答ror \"No process is associated with this object.\". Please tell me how i fi

How to run command SQLLoader Oracle in c#. I try my sourcode for run this SQLLoader, but nothing happen and er开发者_开发问答ror "No process is associated with this object.". Please tell me how i fix it. Thanks. This is my code:

        System.Diagnostics.Process process1;
        process1 = new System.Diagnostics.Process();
        process1.EnableRaisingEvents = false;

        string strCmdLine;
        strCmdLine = @"/C SQLLDR XL/secreat@O11G CONTROL=E:\APT\LoadXL.ctl";
        System.Diagnostics.Process.Start("CMD.exe", strCmdLine);
        process1.WaitForExit();
        process1.Close();


You have to start your process using your variable process1 like so:

process1.StartInfo.Arguments = strCmdLine;
process1.StartInfo.FileName = "CMD.exe";
process1.Start();


This works for me

var p = new Process()
{
    StartInfo = new ProcessStartInfo("sqlldr")
    {
        UseShellExecute = false,
        WorkingDirectory = opts.WorkingDirectory,
        Arguments = "control="control.ctl" userid=usr/pass@XE log="data.csv.log" data="data.csv" bad="data.csv.bad"
     }
};
p.Start();
0

精彩评论

暂无评论...
验证码 换一张
取 消