protected string sRunSQLStmnt(string sSQL) { string sReturn = ""; //Declare the connection object SqlConnection sqlConn = new SqlConnection(connString); int numberOfRecords = 0; try { //Make the connection sqlConn.Open(); //Declare the Command SqlCommand sqlCommand = new SqlCommand(sSQL + " SELECT @@ROWCOUNT AS DELETED;", sqlConn); //Execute the query numberOfRecords = sqlCommand.ExecuteNonQuery(); } catch (Exception ex) { // sDebug += ex; } finally { if (sqlConn.State == System.Data.ConnectionState.Open) { sqlConn.Close(); } sReturn = numberOfRecords.ToString() + " Rows Affected"; } return sReturn; }
Last Updated on October 26, 2015