1. 水晶易表不能识别WS接口返回的DataTable或DataSet数据类型,会提示“无法加载URL”
3. C#调用Oracle的Package,并返回数据列表
2. 经查证,可以接受string类型的,如果需要返回数据列表,那么需要借助数组来返回,代码实现如下:
复制代码 代码如下:
public WeekSale_Table GetData(string skc1, string skc2, string week1, string week2, string week3, string week4)
{
try
{
//C#调用Oracle的包,返回数据列表
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;
cmd.Parameters.Add(ip0);
cmd.Parameters.Add(ip1);
cmd.Parameters.Add(ip2);
cmd.Parameters.Add(ip3);
cmd.Parameters.Add(ip4);
cmd.Parameters.Add(ip5);
OracleParameter p1 = new OracleParameter("p_rc", OracleType.Cursor);
p1.Direction = System.Data.ParameterDirection.Output;
cmd.Parameters.Add(p1);
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;
}
catch
{
return null;
}
}
复制代码 代码如下:
//定义Row,一行
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;
}
//定义Table
public class WeekSale_Table
{
public WeekSale_Row[] row;
}
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
更新日志
- 凤飞飞《我们的主题曲》飞跃制作[正版原抓WAV+CUE]
- 刘嘉亮《亮情歌2》[WAV+CUE][1G]
- 红馆40·谭咏麟《歌者恋歌浓情30年演唱会》3CD[低速原抓WAV+CUE][1.8G]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[320K/MP3][193.25MB]
- 【轻音乐】曼托凡尼乐团《精选辑》2CD.1998[FLAC+CUE整轨]
- 邝美云《心中有爱》1989年香港DMIJP版1MTO东芝首版[WAV+CUE]
- 群星《情叹-发烧女声DSD》天籁女声发烧碟[WAV+CUE]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[FLAC/分轨][748.03MB]
- 理想混蛋《Origin Sessions》[320K/MP3][37.47MB]
- 公馆青少年《我其实一点都不酷》[320K/MP3][78.78MB]
- 群星《情叹-发烧男声DSD》最值得珍藏的完美男声[WAV+CUE]
- 群星《国韵飘香·贵妃醉酒HQCD黑胶王》2CD[WAV]
- 卫兰《DAUGHTER》【低速原抓WAV+CUE】
- 公馆青少年《我其实一点都不酷》[FLAC/分轨][398.22MB]
- ZWEI《迟暮的花 (Explicit)》[320K/MP3][57.16MB]