播客 > 孩子气  >  学着码字下  | 登录  | RSS订阅地址  | Code平台

学着码字下

web.config

<?xml version="1.0" encoding="GB2312" ?>
<configuration>
<appSettings>
    <add key="acdata" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=e:\web\web\net\cjjer\r.mdb" />
    <add key="acdatat" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="  />
    <add key="sqldata" value="server=localhost;database=cjjerdata;uid=sa;pwd=123"/>
</appSettings>
</configuration>


<%@ Import namespace="system.data"%>
<%@ Import namespace="system.data.oledb"%>
<script runat="server">
sub page_load
    dim conn as oledbconnection
    dim cmdsql as oledbcommand
    dim drstr as oledbdatareader
    dim connstr as string =System.Configuration.ConfigurationSettings.AppSettings("acdata").ToString() 
    dim acsql as string="select * from xhtml_arctice where szd_id=2 and id<260"
    conn=new oledbconnection(connstr)
    cmdsql=new oledbcommand(acsql,conn)
    conn.open()
    drstr=cmdsql.executereader()

    txtdata.datasource=drstr
    txtdata.databind()

    drstr.close()
    conn.close()
end sub 
</script>

<form runat="server">
<asp:repeater
id="txtdata"
runat="server">
<headertemplate>
<div style="background-color:#f7f7f7;border:2px solid #b00;margin:auto;width:60%"><h4> headertemplate</h4>
</headertemplate>
<itemtemplate>
<%# container.dataitem("szd_title")%>{<%# container.dataitem("id")%>}
</itemtemplate>

<alternatingitemtemplate><font color='purple'>
<%# container.dataitem("szd_title")%>
</font>
</alternatingitemtemplate>

<separatortemplate>
<hr/>
</separatortemplate>
<footertemplate><h4> footertemplate</h4>
</div>
</footertemplate>
</asp:repeater>
</form>

dataset分页:
<%@ Import namespace="system.data"%>
<%@ Import namespace="system.data.oledb"%>
<script runat="server">
sub page_load
if not ispostback then 
    binddatagrid
end if 
end sub
sub binddatagrid
    dim conn as oledbconnection
    dim daadapter as oledbdataadapter
    dim daset as dataset
    dim connstr as string =System.Configuration.ConfigurationSettings.AppSettings("acdata").ToString() 
    dim acsql as string="select id,szd_title from xhtml_arctice where id>350 "
    conn=new oledbconnection(connstr)
    daadapter=new oledbdataadapter(acsql,conn)
    daset =new dataset
    daadapter.fill(daset)
    txtdata.datasource=daset
    txtdata.databind()
end sub

sub txtdata_pageindexchanged(s as object,e as datagridpagechangedeventargs)
    txtdata.currentpageindex=e.newpageindex
    binddatagrid
end sub
</script>
<html>
<body>
<form runat="server">

<aspatagrid
id="txtdata"
allowpaging="true"
pagesize="3"
onpageindexchanged="txtdata_pageindexchanged"
pagerstyle-mode="numericpages"
pagerstyle-backcolor="coral"
pagerstyle-font-bold="true"
pagerstyle-font-name="verdana"
runat="server">
<columns>


</columns>
</aspatagrid>
</form>
</body>

</html>


天气:大雨,ccdot发表于2006-2-3 12:10:37,阅读了2212次,共有个0回复.

暂无评论

  1. 想要转载我文章的人滚远远的,能想多远,就滚多远。
  2. 不要提交任何带有网址URL信息的评论.
  3. 需要更多信息?请使用站内搜索,郁闷了?听听我在听什么吧!
用户名:*验证:看不清楚请点击刷新验证码*
内容: