Crystal easy table calls WebService of C which returns the application analysis of the data set

  • 2020-06-03 06:17:24
  • OfStack

1. Crystal easy table cannot recognize DataTable or DataSet data type returned by WS interface, and will prompt "URL cannot be loaded"

3. C# calls Package of Oracle and returns a list of data

2. It has been verified that string is acceptable. If you need to return a list of data, you need to use an array to return.

public WeekSale_Table GetData(string skc1, string skc2, string week1, string week2, string week3, string week4)
         //C# call Oracle , which returns a list of data 
                OracleConnection orcn = new OracleConnection(ConfigurationManager.AppSettings["SAPBI"].ToString());
                OracleCommand cmd = new OracleCommand("pkg_cx_Productlifecycle.skcweeksale", orcn);
                cmd.CommandType = CommandType.StoredProcedure;
                OracleParameter ip0 = new OracleParameter("skc1", OracleType.VarChar);
                OracleParameter ip1 = new OracleParameter("skc2", OracleType.VarChar);
                OracleParameter ip2 = new OracleParameter("week1", OracleType.VarChar);
                OracleParameter ip3 = new OracleParameter("week2", OracleType.VarChar);
                OracleParameter ip4 = new OracleParameter("week3", OracleType.VarChar);
                OracleParameter ip5 = new OracleParameter("week4", OracleType.VarChar);
                ip0.Value = skc1;
                ip1.Value = skc2;
                ip2.Value = week1;
                ip3.Value = week2;
                ip4.Value = week3;
                ip5.Value = week4;
                OracleParameter p1 = new OracleParameter("p_rc", OracleType.Cursor);
                p1.Direction = System.Data.ParameterDirection.Output;
                OracleDataAdapter command = new OracleDataAdapter(cmd);
                DataSet ds = new DataSet();
                command.Fill(ds, "Table");
                DataTable dt = ds.Tables["Table"];
                WeekSale_Table wt = new WeekSale_Table();
                wt.row = new WeekSale_Row[dt.Rows.Count];
                int rcount = dt.Rows.Count;
                for (int i = 0; i < rcount; i++)
                    DataRow dr = dt.Rows[i];
                    WeekSale_Row row = new WeekSale_Row();
                    row.DISCOUNT1 = dr["DISCOUNT1"].ToString();
                    row.DISCOUNT2 = dr["DISCOUNT2"].ToString();
                    row.FCALCSUMS1 = dr["FCALCSUMS1"].ToString();
                    row.FCALCSUMS2 = dr["FCALCSUMS2"].ToString();
                    row.NUMS1 = dr["NUMS1"].ToString();
                    row.NUMS2 = dr["NUMS2"].ToString();
                    row.SKC1 = dr["SKC1"].ToString();
                    row.SKC2 = dr["SKC2"].ToString();
                    row.WEEK = dr["WEEK"].ToString();
                    row.WEEKS = dr["WEEKS"].ToString();
                    wt.row[i] = row;
                return wt;
                return null;

// define Row . 1 line 
public class WeekSale_Row
        public string WEEKS;
        public string SKC1;
        public string SKC2;
        public string FCALCSUMS1;
        public string FCALCSUMS2;
        public string NUMS1;
        public string NUMS2;
        public string DISCOUNT1;
        public string DISCOUNT2;
        public string WEEK;
// define Table
public class WeekSale_Table
        public WeekSale_Row[] row;

Related articles: