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");
出错了.
不知道里面的名字该写什么?
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");
出错了.
不知道里面的名字该写什么?
解决方案 »
- C#如何获取特殊字符之间的字符串
- 急:关于ProcessCmdKey
- 哪位给介绍几本介绍IDE开发环境的书本
- C#系列问题-2
- sql语句里发生错误:The left-hand side of an assignment must be a variable
- 请问这段脚本转成aspx应该怎么写 谢谢
- C# winform中 将多个datatable中的内容分别导入到一个Excel中的多个sheet中,该怎么解决,请各位高手帮帮我吧!我都快疯了·
- xna中如何实现3D效果?
- 用c#如何生成 条形码 以及打印条形码???
- C#实现窗体中的控件随意移动
- Windows Form登录的问题
- 怎么在LISTVIEW里把选中的行从列表中删除?
strSQL=strSQL + "(select employeename as 员工,itemname as 项目名称,sum(times) as 人小时 from itemprocessinfo where jobcode='" + stremployeeCode + "'group by itemname,employeename,times";
hzw66(超越理想) 看得比我仔细多了.!!!!