Response.Redirect("./AdminNews.aspx"); Conn.Close(); Cmd.ExecuteNonQuery(); else Response.Write("<script>alert('conn内容不能为空!');history.go(-1);</script>"); if (AltView == "") //结束 Response.Write(err.ToString()); //输出异常信息 catch (Exception err) sw.Close(); sw.Flush(); sw.WriteLine(strhtml); //听说生成把新的内容写到创建的HTML页面中 StreamWriter sw = new StreamWriter(fs, System.Text.Encoding.Default); // 我不知道列表根据上面创建的文件流创建写数据流using (FileStream fs = finfo.OpenWrite()) //以打开或者写入的形式创建文件流 FileInfo finfo = new FileInfo(FilePath); //asp创建文件信息对象-------------------------------------------- FilePath = Server.MapPath("../") + "" + this.Dirpath.Text + "" + "//" + strDate + ".html"; strhtml = strhtml.Replace("$Content", AltView); strhtml = strhtml.Replace("$Time", DateTime.Now.ToString("yyyy/MM/dd")); strhtml = strhtml.Replace("$Title", Titel.Text); } //显示加两个循环输出就可以了 分页代码把i 和 o 用参数替换 再加点代码即可 strhtml = strhtml.Replace("$NewList", newList[i].ToString()); newList[i] = newList[i] + "<li>" + "<a href='" + R_Ds.Tables[0].Rows[o]["html_path"].ToString() + "'>" + R_Ds.Tables[0].Rows[o]["Titel"].ToString() + "</a>" + " " + R_Ds.Tables[0].Rows[o]["Time"].ToString() + "</li>"; for (int o = 0; o < 5; o++) for (int i = 0; i < 5; i++) //学会html给列表数组赋值 string[] newList = new string[5];//设置新闻列表内容数组 int maxnum = R_Ds.Tables[0].Rows.Count; R_Da.Fill(R_Ds, "NewView"); DataSet R_Ds = new DataSet(); SqlDataAdapter R_Da = new SqlDataAdapter("select * from New where Class_id=" + HiddenField1.Value + " order by Time desc", Conn); string FilePath=""; sr.Close(); strhtml.Append(oneline); while ((oneline = sr.ReadLine()) != null) //相比看内容读取指定的HTML文件模板 String oneline; using (StreamReader sr = new StreamReader(Server.MapPath("../template/template.html"),Encoding.GetEncoding("gb2312"))) //创建StreamReader对象 StringBuilder strhtml = new StringBuilder(); string[] newContent = new string[4];//听说Conn定义和html标记数目一致的数组 //开始 + Class.Text + "','" + AltView + "','" + ViewFrom.Text + &quo你知道aspt;','" + keytitle.Text + "','" + HiddenField1.Value + "','"+Urlpath+"')", Conn); SqlCommand Cmd = new SqlCommand("Insert Into NewView(Titel,Class,AltView,ViewFrom,keytitle,Class_i对于sqlconnectiond,html_path)" + "values('" + Titel.Text + "','" string Class_id = this.Class.Text; string strDate = DateTime.Now.ToString("yyyyMMddhhmmss"); string Urlpath = NewsfiConnles.Text; string AltView = content1.Value; Con对于net生成html显示内容和列表SqlConnectionn.Open(); SqlConnection Conn = new SqlConnection(haha.strConn); { Db haha= new Db(); protected void addview_Click(object sender, EventArgs e) new事实上net生成html显示内容和列表SqlConnection asp SqlCon = 对于sqlcon net 对比一下SqlCon 对于asp.ne你知道newt new = (责任编辑:admin) |