string sqljn = "select [序号],[品名],[电压等级],[单位],[型号],[规格],[红本价格] FROM [book].[dbo].[View_wjprice]"; using (SqlConnection con=new SqlConnection(consqlstr)) { con.Open(); using (SqlCommand cmd=con.CreateCommand()) { cmd.CommandText = sqljn; using (SqlDataReader read=cmd.ExecuteReader(CommandBehavior.CloseConnection)) { while (read.Read()) { count++; sql = "insert into eazy_electric(channel_id,company_id,g_id,title,grade,unit,barcode,guide,retail_price,add_time)"; sql += " values(12,56,'"+read["序号"] +"','"+ read["品名"] + "','"+ read["电压等级"] + "','" + read["单位"] + "','" + read["型号"] + "','" + read["规格"] + "','" + read["红本价格"] + "','"+DateTime.Now.ToString()+"')"; DbHelperSQL.ExecuteSql(sql); sql = "insert into eazy_electric_history(channel_id,company_id,g_id,title,grade,unit,barcode,guide,retail_price,add_time)"; sql += " values(12,56,'"+read["序号"] +"','"+ read["品名"] + "','"+ read["电压等级"] + "','" + read["单位"] + "','" + read["型号"] + "','" + read["规格"] + "','" + read["红本价格"] + "','" + DateTime.Now.ToString() + "')"; DbHelperSQL.ExecuteSql(sql); } } } }
using (SqlDataReader read = DbHelperSQL.ExecuteReader(sql)) { while (read.Read()) { count++; htmlstr += ""; htmlstr += ""; htmlstr += " "; htmlstr += ""; } }"; htmlstr += ""; htmlstr += ""; htmlstr += ""; htmlstr += "" + read["ylcode"] + ""; htmlstr += ""+read["itemname"] +""; htmlstr += "" + read["itemcontent"] + ""; htmlstr += "" + read["danwei"] + ""; htmlstr += "" + read["price"] + ""; htmlstr += "