Click here to Skip to main content
15,888,293 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
			string b =System.Configuration.ConfigurationSettings.AppSettings["OracleConnString"];
			string strSQLLdrPath = System.Configuration.ConfigurationSettings.AppSettings["SQLLDRPath"];
			string strSQLLdrUserId = System.Configuration.ConfigurationSettings.AppSettings["SQLLDRUserId"];
			string strCntrlFilePath = System.Configuration.ConfigurationSettings.AppSettings["CntrlFilePath"];
			string strDataFilePath = System.Configuration.ConfigurationSettings.AppSettings["DataFilePath"];
			string strLogFilePath = System.Configuration.ConfigurationSettings.AppSettings["LogFilePath"];
			string strBadFilePath = System.Configuration.ConfigurationSettings.AppSettings["BadFilePath"];
			try
			{
		
				log.Info("Invoking SQL*Loader to load file: " + strDataFilePath);
				Process p= new Process();
				
				// Start User Name Changes dt-10th Sep 2007
				//				if(strUserId.IndexOf(" ") >= 0)
				//				{
				//					strUserId = strUserId.Replace(" ","");
				//				}
				// End User Name Changes dt-10th Sep 2007
				strLogFilePath = strLogFilePath + "data_"+".log";
				strBadFilePath = strBadFilePath + "data_"+ ".bad";
				p.StartInfo.Arguments=@strSQLLdrUserId + " control= "+ strCntrlFilePath+ " data= "+ strDataFilePath + " log= " + strLogFilePath +" bad= "+ strBadFilePath + " rows=5000 errors=15000 skip=1 ";
				p.StartInfo.FileName = strSQLLdrPath ;
				p.StartInfo.WindowStyle =ProcessWindowStyle.Hidden;
				p.Start();
				p.WaitForExit();
				log.Info("SQL*Loader work completed.");
			}
			catch(Exception ex)
			{
				log.Error("Problems with SQLLoader" ,ex);
			}
		}
Posted
Updated 5-Apr-12 18:31pm
v2

Add this line before passing path to file name:

C#
using System.IO;


To Check if path exists:
C#
if(!Directory.Exists(path))
            {
//throw exception here or show message box like this:
MessageBox.Show(path);
            }
else
{
//do something here.
}


To check if file exists:
C#
if(File.Exists(filepath)
{
//throw exception here or show message box like this:
MessageBox.Show(filepath)
}
else
{
//do something here.
}
 
Share this answer
 
Comments
Praveen Kullu 6-Apr-12 1:31am    
I am showing path and filepath in messagebox so that you may know the exact path and the error.
Just debug line by line and see where you are getting this error
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900