0

How to run command SQLLoader Oracle in c#. I try my sourcode for run this SQLLoader, but nothing happen and error "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();

2 Answers 2

1

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

process1.StartInfo.Arguments = strCmdLine;
process1.StartInfo.FileName = "CMD.exe";
process1.Start();
Sign up to request clarification or add additional context in comments.

5 Comments

Thanks for your answer, but when i put script above in my code, not happening and process SQLLoader not running.
I suggest that you put the command line into a batch file, put a pause command at the end and launch that batch file. This way, you can check the output for any error message.
thanks for the suggestion, but I made it in c #. Why if I replace the command with ipconfig running. Was not able to run the process SQLLOader in c #
My suggestion was to start that batch file from C#. I assume, it simple can't find "sqlldr".
I was facing a similar problem. I had to write de command in a cmd file, and then: process1.StartInfo.FileName = "file.cmd";
0

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();

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.