日期:2014-05-17 浏览次数:20406 次
protected void btnexcel_Click(object sender, EventArgs e)
{
StringWriter sw = new StringWriter();
sw.WriteLine("Id\t报装编号\t业主姓名\t性别\t出生年月\t联系电话\tQQ\tEmail\t微信\t报修地址\t建筑面积\t户型\t预约时间\t你知道\t能实现什么功能\t如何知道\t你最看以下哪方面内容\t最吸引你的地方在哪里");
SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["hkdconstr"].ConnectionString);
conn.Open();
SqlCommand cmd = new SqlCommand("select id , seokey , partname1 ,tel1 ,fax1 ,coad1 ,email1 ,address1 ,partname2 ,tel2 ,fax2 ,coad2 ,email2 ,address2 ,partname3 ,tel3 ,fax3 ,coad3 from lx1", conn);
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
sw.WriteLine(reader["id"].ToString() + "\t" + reader["seokey"].ToString() + "\t" + reader["partname1"].ToString() + "\t" + reader["tel1"].ToString() + "\t" + reader["fax1"].ToString() + "\t" + reader["coad1"].ToString() + "\t"+
reader["email1"].ToString() + "\t" + reader["address1"].ToString() + "\t" + reader["partname2"].ToString() + "\t" + reader["tel2"].ToString() + "\t" + reader["fax2"].ToString() + "\t" + reader["coad2"].ToString() + "\t"+
reader["email2"].ToString() + "\t" + reader["address2"].ToString() + "\t" + reader["partname3"].ToString() + "\t" + reader["tel3"].ToString() + "\t" + reader["fax3"].ToString() + "\t" + reader["coad3"].ToString() + "\t"