public DataSet SetWithDataSet(ArrayList param, string SPName, out long ReturnValue, int CompanyIndex = 0) { ReturnValue = 0L; try { if (General.DataBase.Equals("SQL")) { SQLDBResult dbResult = SQLAdapter.Execute(SPName, param, SQLAdapter.GetConnection(CompanyIndex)); ReturnValue = Convert.ToInt64(dbResult.Parameters[(object)"@RETURN_VALUE"]); this.LogException(param, SPName, CompanyIndex, dbResult, "", ReturnValue); return(dbResult.Contents); } } catch (Exception ex) { this.LogException(param, SPName, CompanyIndex, (SQLDBResult)null, ex.Message, ReturnValue); } return(new DataSet()); }
public static SQLDBResult Execute(string procedureName, ArrayList procedureParameters, string strConnection) { SQLDBResult sqldbResult = (SQLDBResult)null; SqlConnection connection = (SqlConnection)null; try { connection = new SqlConnection(strConnection); connection.Open(); SqlCommand selectCommand = SQLAdapter.Procedure(connection, procedureName, (SqlTransaction)null).Command(connection, procedureParameters); selectCommand.CommandTimeout = 0; sqldbResult = new SQLDBResult(); new SqlDataAdapter(selectCommand).Fill(sqldbResult.Contents); foreach (SqlParameter sqlParameter in (DbParameterCollection)selectCommand.Parameters) { switch (sqlParameter.Direction) { case ParameterDirection.Output: case ParameterDirection.InputOutput: case ParameterDirection.ReturnValue: sqldbResult.Parameters[(object)sqlParameter.ParameterName] = sqlParameter.Value; continue; default: continue; } } } catch (Exception ex) { throw new SQLAdapter.DbUtilException(ex.Message, ex); } finally { if (connection != null && connection.State == ConnectionState.Open) { connection.Close(); } } return(sqldbResult); }
public DataSet Get(ArrayList param, string SPName, int CompanyIndex = 0) { DataSet dataSet = new DataSet(); long ReturnValue = 0L; try { if (General.DataBase.Equals("SQL")) { SQLDBResult dbResult = SQLAdapter.Execute(SPName, param, SQLAdapter.GetConnection(CompanyIndex)); dataSet = dbResult.Contents; ReturnValue = Convert.ToInt64(dbResult.Parameters[(object)"@RETURN_VALUE"]); //if (SPName == "sp_GetUserDetails") // throw new Exception(); this.LogException(param, SPName, CompanyIndex, dbResult, "", ReturnValue); } } catch (Exception ex) { this.LogException(param, SPName, CompanyIndex, (SQLDBResult)null, ex, ReturnValue); } return(dataSet); }
public bool IsDatabaseExists() { try { SQLAdapter.Execute(" if exists(select name from sys.databases where name='pact2c') RAISERROR('-100',16,1) ", SQLAdapter.GetConnection()); return(false); } catch (Exception ex) { return(true); } }
public int ExecuteScript(string Query, int CompanyIndex = 0) { return(SQLAdapter.Execute(Query, SQLAdapter.GetConnection(CompanyIndex))); }