日期:2014-05-18  浏览次数:20739 次

菜鸟求救 麻烦高手帮忙改下 不显示数据啊
//为result添加DataColumn对象
  result.Columns.Add(new DataColumn("rvencode", typeof(string)));//供应商代码
  result.Columns.Add(new DataColumn("rvenname", typeof(string)));//名称
  result.Columns.Add(new DataColumn("rinvcode", typeof(string)));//存货编码
  result.Columns.Add(new DataColumn("rinvname", typeof(string)));//存或名称
  result.Columns.Add(new DataColumn("rlastpo", typeof(string)));//最近po
  result.Columns.Add(new DataColumn("rlastquality", typeof(float)));//最近采购数量
  result.Columns.Add(new DataColumn("rlastisum", typeof(float)));//最近采购金额
  result.Columns.Add(new DataColumn("rliunitprice", typeof(float)));//系统最低价
  result.Columns.Add(new DataColumn("rmiunitprice", typeof(float)));//系统最高价
  result.Columns.Add(new DataColumn("rniunitprice", typeof(Single)));//最新价
  result.Columns.Add(new DataColumn("raiunitprice", typeof(Single)));//平均价
  result.Columns.Add(new DataColumn("rtyearaver", typeof(Single)));//今年平均价
  result.Columns.Add(new DataColumn("rbyearaver", typeof(Single)));//去年平均价
  result.Columns.Add(new DataColumn("rtyearjqaver", typeof(Single)));//今年加权平均价
  result.Columns.Add(new DataColumn("rbyearjqaver", typeof(Single)));//去年加权平均价
  //strsql = strsql + "select cvencode,cinvcode from PO_Pomian,PO_Podetails";
  //if (txtvendor1.Text.Trim() != "")
  //{
  // strsql = strsql + " where cvencode>='" + txtvendor1.Text.Trim() + "' and cvencode <= '" + txtvendor2.Text.Trim() + "'";
  //}
  //if (txtinvcode1.Text.Trim() != "")
  //{
  // strsql = strsql + " and cinvcode>='" + txtinvcode1.Text.Trim() + "' and cinvcode <='" + txtinvcode2.Text.Trim() + "'";
  //}
  //if (dtp1.Checked)
  //{
  // strsql = strsql + " and dPODate >='" + dtp1.Value + "' and dPODate <='" + dtp2.Value + "'";
  //}
  //strsql = strsql + " group BY cinvcode,cvencode";
  strsqla = strsqla + "select cinvcode,cvencode from po_poview where 1=1";
  if (txtvendor1.Text.Trim() != "")
  {
  strsqla = strsqla + " and cvencode='" + txtvendor1.Text.Trim() + "'and cvencode <= '" + txtvendor2.Text.Trim() + "'";
  }
  if (txtinvcode1.Text.Trim() != "")
  {
  strsqla = strsqla + " and cinvcode='" + txtinvcode1.Text.Trim() + "' and cinvcode <='" + txtinvcode2.Text.Trim() + "'";
  }
  if (dtp1.Checked)
  {
  strsqla = strsqla + " and dPODate >='" + dtp1.Value + "' and dPODate <='" + dtp2.Value + "'";
  }
  strsqla = strsqla + " group BY cinvcode,cvencode";
  conn.Open();
  SqlDataAdapter sqldtp = new SqlD