首页 > 代码库 > 888

888

using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;namespace Web.Test._Excel{    using Web.Utils;    using System.Data;    using System.Data.SqlClient;    using System.Drawing;    public partial class Default : System.Web.UI.Page    {        DataSet ds;        DataTable dt;        protected void Page_Load(object sender, EventArgs e)        {            string sql = "select top 30 o.* from T_WordInfo o";            ds = HelperDb.ExecuteAll(HelperDb.connStr, CommandType.Text,                sql, HelperKeys.DataSet) as DataSet;            if (HelperValidate.CheckedDataSet(ds))            {                dt = ds.Tables[0];                this.gv01.DataSource = dt = ds.Tables[0];                this.gv01.DataBind();            }        }        protected void Button1_Click(object sender, EventArgs e)        {            // ExcelHelper e = new ExcelHelper();            //ExcelHelper.OutputToExcel(dt,"C:\\1.xls");            //MailAttachments ma = new MailAttachments();            //ma.Add(@"C:\1.xls");            //MailMessage mail = new MailMessage();            //mail.Attachments = ma;            //mail.Body = "你好";            //mail.AddRecipients("aa@qq.com");            //mail.From = "aa@qq.com";            //mail.FromName = "zkp";            //mail.Subject = "hello ni";            //SmtpClient sp = new SmtpClient();            //sp.SmtpServer = "smtp.qq.com";            //sp.Send(mail, "aa@qq.com", "aaa");            YZMHelper y = new YZMHelper();            y.CreateImage();            Bitmap b = y.Image;            //Panel1.BackImageUrl = b;            //ImageMap1.            //Response.Write(b);        }    }}

888