isql has output parameter : /o public int Exec( string sCommand ) { int nResult = 0; m_oInstallProcess = new Process(); m_oInstallProcessInfo = new ProcessStartInfo("cmd"); m_oInstallProcessInfo.UseShellExecute = false; m_oInstallProcessInfo.RedirectStandardInput = true; m_oInstallProcessInfo.RedirectStandardOutput = true; m_oInstallProcessInfo.RedirectStandardError = true; m_oInstallProcessInfo.CreateNoWindow = true; m_oInstallProcess.StartInfo = m_oInstallProcessInfo; m_oInstallProcess.Start(); m_oCommandWriter = m_oInstallProcess.StandardInput; m_oResultReader = m_oInstallProcess.StandardOutput; m_oErrorReader = m_oInstallProcess.StandardError; m_oCommandWriter.AutoFlush = true; m_oCommandWriter.WriteLine( sCommand ); m_oCommandWriter.Close(); m_oCommandWriter = null; string s = m_oResultReader.ReadToEnd(); m_sErrorMsg = m_oErrorReader.ReadToEnd(); if( s.IndexOf("Cannot open input file") > 0 ) throw new Exception( "Command:\r\n"+sCommand+"\r\nError:\r\nCannot open input file!" ); else if( m_sErrorMsg.Trim().Length > 0 ) throw new Exception( "Command:\r\n"+sCommand+"\r\nError:\r\n"+m_sErrorMsg+"" ); else System.Threading.Thread.Sleep( 10 ); return nResult ; } D!shan
dishanf
Posts
-
Urgent : Running SQL Script files through a SqlCommand object? -
Is This Complex Update Possible?Oh.. sorry . already answered! .. net is too slow :( D!shan
-
Is This Complex Update Possible?Yes . you can update from one or more table ., Try this sql. may be want to change some col names. I think you get the idea.. ;) UPDATE StoreItems SET Cost = T.CaseCost / T.CaseCount FROM StoreItems S INNER JOIN TicketItems T ON S.PLU = T.PLU HTH D!shan
-
Need Help to make SQL SERVER QueryTry this also.. its little bit matching to ur prob.. OR is it ok to doing this through cursors? USE pubs GO DECLARE @title_ids varchar(150), @delimiter char SET @delimiter = ',' SELECT @title_ids = COALESCE(@title_ids + @delimiter, '') + title_id FROM titles SELECT @title_ids AS [List of Title IDs] D!shan
-
Problem with Stored Procedure's Return valueTry... // Add the return value parameter SqlParameter param = m_oCommand.Parameters.Add( "RETURN_VALUE", SqlDbType.Int ); param.Direction = ParameterDirection.ReturnValue; D!shan
-
Need Help to make SQL SERVER QueryIs not easy to get the result in one simple query! . At least you must write a cursor to doing this.. D!shan
-
previous record problemHi , Find the exact line it occers. it says your object(may be oleDbConnection1 ) is still null, but your going to call its method. D!shan
-
fill an access table with a datasetHi You can build a multi sql statement and execute it once!. you dont need to execute singel insert / update statements many times. Ex. sSQL = "INSERT INTO .....;INSERT INTO ...;INSERT.." executeQuery( sSQL ); HTH., D!shan :cool:
-
sql statementsSELECT * FROM sysobjects WHERE type = 'U' D!shan
-
Count (*)SQLQuery = "SELECT COUNT(*) AS 'NoOfRows' FROM Log" and use executeQuery D!shan
-
fill an access table with a datasetDid you tried to use Table Direct for Fill data set D!shan