从数据库中取值批量生成html文件
1. web.config
<connectionStrings>
<add name ="myconn" connectionString="Data Source=who\SQLEXPRESS; Initial Catalog=dbname;Integrated Security=True;" providerName="System.Data.SqlClient"/>
</connectionStrings>
2.
string htmlPath = "D:\\htmlFiles";
string[] files = Directory.GetFiles(htmlPath,"*.html");
foreach (string filename in files)
{
File.Delete(filename);
}
3.
string conn = ConfigurationManager.ConnectionStrings["myconn"].ToString();
SqlConnection sqlconn = new SqlConnection(conn);
SqlCommand scom = new SqlCommand("select * from table",sqlconn);
SqlDataAdapter sda = new SqlDataAdapter(scom);
DataSet ds = new DataSet();
sda.Fill(ds);
if (ds.Tables[0].Rows.Count > 0)
{
writeHtml(ds);
}
4.
foreach (DataRowView drv in dv)
{
int pid = int.Parse(drv["pid"].ToString().Trim());
string id_name = drv["ID_Name"].ToString().Trim();
string en_title = drv["en_title"].ToString().Trim();
string en_contents = drv["en_contents"].ToString();
string htmlName = String.Format("{0:D4}{1}.html",pid,id_name);
htmlName = htmlName.Replace(' ','_');
htmlName = htmlName.Replace('/','_');
htmlName = htmlName.Replace(':','_');
string htmlContents = "<html><head><title>" + en_title + "</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\"><LINK href="\" mce_href="\""css.css\" type=\"text/css\" rel=\"stylesheet\"></head><body><table><tbody><tr valign=\"top\"><td valign=\"top\" height=\"467\" width=\"696\">" + en_contents + "</td></tr></tbody></
相关文档:
比如说现在有两个毫无关系的html页面:a.html;b.html
从a.html跳到b.html时如何在b.html页面中获得a.html传过来的数据呢?
代码如下:
在a.html中有一个连接指向b.html,<a href="b.html?name='wangzheguilai'">转到b</a>
在b.html中就可以通过js这样获得name的值<script>var name=window.location.se ......
什么是 HTML 文件?
HTML 指超文本标签语言。
HTML 文件是包含一些标签的文本文件。
这些标签告诉 WEB 浏览器如何显示页面。
HTML 文件必须使用 htm 或者 html 作为文件扩展名。
HTML 文件可以通过简单的文本编辑器来创建。
做个实验如何?
第一步:如果您使用 Windows,请启动记事本。
如果您使用 Mac,请启 ......
转帖,不说话
字符
十进制
转义字符
"
"
"
&
&
&
<
<
<
>
>
>
不断开空格(non-breaking space)
 
字符
十进制
转义字符
字符
十进制
转义字符
字符
十进制
转义字符
?
¡
& ......
HTML:
<META HTTP-EQUIV="pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
<META HTTP-EQUIV="expires" CONTENT="0">
PHP:
header("Expires: Mon, 26 Jul 1997 ......
此处嵌入的flash里面的图片是可以随时发生改变的图片(动态图片)
注意蓝色字体的地方,这些地方都要统一
<script language="javascript">AC_FL_RunContent = 0;</script>
<script src="${ctx}/ui/Login/AC_RunActiveContent.js"
language="javascript"></script& ......