没有合适的资源?快使用搜索试试~ 我知道了~
ASPNET生成静态页面,很方面的搞定SQL 调用
5星 · 超过95%的资源 需积分: 3 12 下载量 67 浏览量
2009-05-11
16:32:33
上传
评论
收藏 6KB TXT 举报
温馨提示
试读
5页
ASPNET生成静态页面,很方面的搞定SQL 调用,目前改技术用在了http://www.go888.cn 首页就是用方法提取SQL信息. 当然在此基础上还能扩展更多功能出来.有兴趣的朋友可以继续扩展或重写.
资源推荐
资源详情
资源评论
ASPNET生成静态页面,很方面的搞定SQL 调用,目前改技术我用在了http://www.go888.cn 首页就是用方法提取SQL信息. 当然在此基础上还能扩展更多功能出来.有兴趣的朋友可以继续扩展或重写.
以下是模版文件:default.htm内容
<!-- {inc heads.htm} --> /* 引用文件可以理解为<!--#INCLUDE FILE="pub.aspx"-->*/
<!-- {inc Content.htm} -->
在模版.html文件中直接写SQL语句提取数据库内容
<!-- {run SELECT top 4 B_guid,M_guid,B_title,B_imagesUrl,CONVERT(varchar,B_price*B_zhekou,0) as price,CONVERT(varchar,B_price,0) as B_price from DB_business where ISINDEXVIEW=0 AND ISDEL=0 order by Addtime desc} -->
<table width="100%" border="0" cellspacing="0" cellpadding="2" ID="Table7">
<tr align="center" valign="middle">
<!-- {rep 2} --><td valign=bottom height=18><a href=business/view_shop.aspx?ID=<!-- {val B_guid} -->&GUID=<!-- {val m_guid} --> title="<!-- {val B_title} -->" target=_blank class=indexshop><img src="manage/upfile/<!-- {val B_imagesUrl} -->" width="80" height="80" border=0 style='BORDER-RIGHT:#cccccc 1px solid; BORDER-TOP:#cccccc 1px solid; BORDER-LEFT:#cccccc 1px solid; BORDER-BOTTOM:#cccccc 1px solid'></a><br><a href=manage/shop/CartList.aspx?Cartid=<!-- {val B_guid} --> target=_blank class=indexshop title='原价<!-- {val B_price} -->元'><img src=business/images/buy_y.gif width=18 height=13 border=0>现价<!-- {val price} -->元</a></td><!-- {next} --><!-- {end rep} -->
</tr>
<tr align="center" valign="middle">
<!-- {rep 2} --><td valign=bottom height=18><a href=business/view_shop.aspx?ID=<!-- {val B_guid} -->&GUID=<!-- {val m_guid} --> title="<!-- {val B_title} -->" target=_blank class=indexshop><img src="manage/upfile/<!-- {val B_imagesUrl} -->" width="80" height="80" border=0 style='BORDER-RIGHT:#cccccc 1px solid; BORDER-TOP:#cccccc 1px solid; BORDER-LEFT:#cccccc 1px solid; BORDER-BOTTOM:#cccccc 1px solid'></a><br><a href=manage/shop/CartList.aspx?Cartid=<!-- {val B_guid} --> target=_blank class=indexshop title='原价<!-- {val B_price} -->元'><img src=business/images/buy_y.gif width=18 height=13 border=0>现价<!-- {val price} -->元</a></td><!-- {next} --><!-- {end rep} -->
</tr>
</table>
<!-- {inc foot.htm} -->
default.htm内容结束
以下是GreatePage.aspx文件内容:
private void Page_Load(Object sender,EventArgs e)
{
if(!Page.IsPostBack)
{
BuildToFile("../index.html"); /*传递生成文件名称参数.*/
}
private void BuildToFile(string fileName)
{
StreamReader fileReader = new StreamReader(Server.MapPath("Template_index/default.htm"), Encoding.Default);
string fileStr = fileReader.ReadToEnd();
fileReader.Close();
fileStr = DecorateFileString(fileStr);
以下是模版文件:default.htm内容
<!-- {inc heads.htm} --> /* 引用文件可以理解为<!--#INCLUDE FILE="pub.aspx"-->*/
<!-- {inc Content.htm} -->
在模版.html文件中直接写SQL语句提取数据库内容
<!-- {run SELECT top 4 B_guid,M_guid,B_title,B_imagesUrl,CONVERT(varchar,B_price*B_zhekou,0) as price,CONVERT(varchar,B_price,0) as B_price from DB_business where ISINDEXVIEW=0 AND ISDEL=0 order by Addtime desc} -->
<table width="100%" border="0" cellspacing="0" cellpadding="2" ID="Table7">
<tr align="center" valign="middle">
<!-- {rep 2} --><td valign=bottom height=18><a href=business/view_shop.aspx?ID=<!-- {val B_guid} -->&GUID=<!-- {val m_guid} --> title="<!-- {val B_title} -->" target=_blank class=indexshop><img src="manage/upfile/<!-- {val B_imagesUrl} -->" width="80" height="80" border=0 style='BORDER-RIGHT:#cccccc 1px solid; BORDER-TOP:#cccccc 1px solid; BORDER-LEFT:#cccccc 1px solid; BORDER-BOTTOM:#cccccc 1px solid'></a><br><a href=manage/shop/CartList.aspx?Cartid=<!-- {val B_guid} --> target=_blank class=indexshop title='原价<!-- {val B_price} -->元'><img src=business/images/buy_y.gif width=18 height=13 border=0>现价<!-- {val price} -->元</a></td><!-- {next} --><!-- {end rep} -->
</tr>
<tr align="center" valign="middle">
<!-- {rep 2} --><td valign=bottom height=18><a href=business/view_shop.aspx?ID=<!-- {val B_guid} -->&GUID=<!-- {val m_guid} --> title="<!-- {val B_title} -->" target=_blank class=indexshop><img src="manage/upfile/<!-- {val B_imagesUrl} -->" width="80" height="80" border=0 style='BORDER-RIGHT:#cccccc 1px solid; BORDER-TOP:#cccccc 1px solid; BORDER-LEFT:#cccccc 1px solid; BORDER-BOTTOM:#cccccc 1px solid'></a><br><a href=manage/shop/CartList.aspx?Cartid=<!-- {val B_guid} --> target=_blank class=indexshop title='原价<!-- {val B_price} -->元'><img src=business/images/buy_y.gif width=18 height=13 border=0>现价<!-- {val price} -->元</a></td><!-- {next} --><!-- {end rep} -->
</tr>
</table>
<!-- {inc foot.htm} -->
default.htm内容结束
以下是GreatePage.aspx文件内容:
private void Page_Load(Object sender,EventArgs e)
{
if(!Page.IsPostBack)
{
BuildToFile("../index.html"); /*传递生成文件名称参数.*/
}
private void BuildToFile(string fileName)
{
StreamReader fileReader = new StreamReader(Server.MapPath("Template_index/default.htm"), Encoding.Default);
string fileStr = fileReader.ReadToEnd();
fileReader.Close();
fileStr = DecorateFileString(fileStr);
资源评论
- zqy201112013-05-07学习一下,估计有用。
nihaowangli2008
- 粉丝: 0
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功