Hello,

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

>No process is associated with this object.". Please tell me how i fix it.

SQLLDR is an executable and it will be your main process.

strCmdLine = @"SQLLDR XL/secreat@O11G CONTROL=E:\APT\LoadXL.ctl";
System.Diagnostics.Process.Start(strCmdLine);

You create a process object (line 2) and set some parameters and then execute "cmd.exe" without using the process at all (line 7 call to static Process.Start).

Line 8/9 there is nothing running under this process object so these commands have nothing to do so you get the error.

You need to set the StartInfo property of the process object you've created. Take a look at this to see how it is done.

Thanks for your answer, I tried with your suggestion but still error "The system cannot find the file specified"

>No process is associated with this object.". Please tell me how i fix it.

SQLLDR is an executable and it will be your main process.

strCmdLine = @"SQLLDR XL/secreat@O11G CONTROL=E:\APT\LoadXL.ctl";
System.Diagnostics.Process.Start(strCmdLine);

Where is SQLLDR.EXE? Put a path here.

strCmdLine = @"C:\oracle\something\bin\SQLLDR XL/secreat@O11G CONTROL=E:\APT\LoadXL.ctl";
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.