Ejemplo n.º 1
0
    public bool CallWOApi(SqlCommand sqcmd)
    {
        // need to close previous reader here, because of
        // "There is already an open DataReader associated with this Command which must be closed first"
        if (reader != null)
        {
            reader.Close();
            reader = null;
        }

        reader = sql.Select(sqcmd);
        if (reader == null)
        {
            return(false);
        }
        reader.Read();

        try
        {
            string rm = "";
            try
            {
                rm = reader["ResultMsg"].ToString();
            }
            catch { }

            int rc = Convert.ToInt32(reader["ResultCode"]);
            if (rc != 0)
            {
                Response.Write("WO_" + rc + " " + rm);
                return(false);
            }
        }
        catch (Exception)
        {
            throw new ApiExitException("ResultCode not set");
            //return false;
        }

        // move to actual result data
        reader.NextResult();
        return(true);
    }
Ejemplo n.º 2
0
    public bool CallWOApi(SqlCommand sqcmd)
    {
        CloseDataReader();

        reader = sql.Select(sqcmd);
        if (reader == null)
        {
            return(false);
        }
        reader.Read();

        try
        {
            string rm = "";
            try
            {
                rm = reader["ResultMsg"].ToString();
            }
            catch { }

            int rc = Convert.ToInt32(reader["ResultCode"]);
            if (rc != 0)
            {
                Response.Write("WO_" + rc + " " + rm);
                return(false);
            }
        }
        catch (Exception)
        {
            throw new ApiExitException("ResultCode not set");
            //return false;
        }

        // move to actual result data
        reader.NextResult();
        return(true);
    }