ConnHelper.Sqlconn.ConnOpen();
SqlDataAdapter dr=new SqldataAdapter("select login_name,login_pwd from tb_login",ConnHelper.Sqlconn.conn);
DataSet ds=new DataSet();
dr.Fill(ds);
DataView dv=ds.Tables[0].DefaultView;
DataTable dt=dv.Table;
Excel.Application excel=new Excel.Application();
excel.Application.Workbooks.Add(true);
exce.cells[1,1]="用户姓名";
excel.cells[1,2]="用户密码";
for(int i=1;i<=dt.Rows.Count;i++)
{
for(int j=1;j<=dt.Columns.Count;j++)
{
excel.cells[i+1,j]=dv[i-1][j-1];
}
}
excel.Visible=true;