OleDbConnection oleDbConnection1=new OleDbConnection();
oleDbConnection1.ConnectionString="User ID=sa;Data Source=XJH;Tag with column collation when possible=False;Initial Catalog=sdoa;Use Procedure for Prepare=1;Auto Translate=True;Persist Security Info=False;Provider='SQLOLEDB.1';Workstation ID=XJH;Use Encryption for Data=False;Packet Size=4096";
oleDbConnection1.Open();
strSQL="select * from ";
strSQL="(select employeename as 员工,itemname as 项目名称,sum(times) as 人小时 from itemprocessinfo where jobcode='" + stremployeeCode + "'group by itemname,employeename,times";
strSQL=strSQL+" union select '合计','',sum(times) as 人小时 from itemprocessinfo where jobcode='" + stremployeeCode + "')";
strSQL=strSQL+" as itemprocessinfo1 order by 项目名称 DESC";
OleDbDataAdapter dataAdapter = new OleDbDataAdapter (strSQL,oleDbConnection1);
DataSet ds = new DataSet();
dataAdapter.Fill(ds,"itemprocessinfo1");
DataGrid1.DataSource = ds.Tables["itemprocessinfo"];
DataGrid1.DataBind();这段代码中:
dataAdapter.Fill(ds,"itemprocessinfo1");
出错了.
不知道里面的名字该写什么?

解决方案 »

  1.   

    sql语句问题.dataset里面的名称是自定义的
      

  2.   

    sql语句,我用sql查询器验证过的,都OK的.
      

  3.   

    strSQL="select * from ";
    strSQL=strSQL + "(select employeename as 员工,itemname as 项目名称,sum(times) as 人小时 from itemprocessinfo where jobcode='" + stremployeeCode + "'group by itemname,employeename,times";
      

  4.   

    结了.找到问题所在了.
     hzw66(超越理想)   看得比我仔细多了.!!!!