473,395 Members | 1,393 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

problem with system.process

Hi,

this is my code, below, I am executing a batch file that in turn executes
multiple .sql files, my concern is if there is some problem with .sql files,
the calling program should get the error back, that is not happening.

do you have any idea how to trap the error with Process?

thanks,

Prashant

arrDbProperties = ConnectionString.Split(';');

arrServerName = arrDbProperties[0].Split('=');

arrDbName = arrDbProperties[1].Split('=');

dbName = arrDbName[1].Trim().ToString();

serverName = arrServerName[1].Trim().ToString();

sqlFilePath = webConfigPath + "ICE2.1Temp\\ICE2.1\\SQL\\";

batchFile = webConfigPath + "ICE2.1Temp\\ICE2.1\\SQL\\Drop_DB2.1.bat";

Process proc = new Process();

proc.EnableRaisingEvents = false;

proc.StartInfo.FileName = batchFile;

proc.StartInfo.Arguments = dbName + " " + serverName + " " + sqlFilePath;

proc.Start();

proc.WaitForExit();

proc = null;


Nov 19 '05 #1
1 969
With Process, you can get the command line output in the Standard Output of
the process object. That being said, SQL does not always output errors and
exceptions, which means you must check for errors in your batches and output
using PRINT statements to see some errors. I would look in this direction to
ensure you are getting these exceptions if you wish to fire off SQL code in
Process (ie, in a black box).
---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************

"Prashant" wrote:
Hi,

this is my code, below, I am executing a batch file that in turn executes
multiple .sql files, my concern is if there is some problem with .sql files,
the calling program should get the error back, that is not happening.

do you have any idea how to trap the error with Process?

thanks,

Prashant

arrDbProperties = ConnectionString.Split(';');

arrServerName = arrDbProperties[0].Split('=');

arrDbName = arrDbProperties[1].Split('=');

dbName = arrDbName[1].Trim().ToString();

serverName = arrServerName[1].Trim().ToString();

sqlFilePath = webConfigPath + "ICE2.1Temp\\ICE2.1\\SQL\\";

batchFile = webConfigPath + "ICE2.1Temp\\ICE2.1\\SQL\\Drop_DB2.1.bat";

Process proc = new Process();

proc.EnableRaisingEvents = false;

proc.StartInfo.FileName = batchFile;

proc.StartInfo.Arguments = dbName + " " + serverName + " " + sqlFilePath;

proc.Start();

proc.WaitForExit();

proc = null;


Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Sudesh Sawant | last post by:
Hello, We have an application which communicates using remoting. There is a server which is a Windows Service. The server exposes an object which is a singleton. The client is a Web Application...
1
by: Primo | last post by:
Hello, I am building a data management application with the following processes: Process 1 is a Windows service which uses FileSystemWatcher to monitor a directory. Process 2 opens a file...
2
by: Praveen K | last post by:
I have a problem in communicating between the C# and the Excel Interop objects. The problem is something as described below. I use Microsoft Office-XP PIA dll’s as these dll’s were been...
2
by: Bala Nagarajan | last post by:
Hello, I am having issues when i use the Systsem.Diagnostics.Process namespace to start a process. The problem is that i am able to succeed in starting a process (an exe) only few times in a row...
1
by: daniel_xi | last post by:
Hi all, I am running a VS 2003 .NET project on my client machine (Win 2000 SP4, ..NET framework 1.1), running an ASP.NET application on a remote web server (Win 2000 Server, IIS 6.0, .NET...
5
by: Benzi Eilon | last post by:
I have written a C# application which should run as a Windows Service. I must avoid having multiple instances of the application on one machine so I inserted the following code at the beginning of...
3
by: garyusenet | last post by:
Hello everyone I hope you are having a good evening. This evening I made a method that allows me to find the process id's of running processes of a given 'friendly name' - using...
9
by: HC | last post by:
Hello, all, I started out thinking my problems were elsewhere but as I have worked through this I have isolated my problem, currently, as a difference between MSDE and SQL Express 2005 (I'll just...
0
by: dot.yet | last post by:
Hi Everyone, environment: DB2 9.5 WSE with FP 2a Solaris 10 u5 - 64-bit SMP - 2 Quad CPUS - total 8 cores 16 GB RAM SAMPLE database Solaris Containers
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.