Posted on 2008-07-25 14:55
『一根牙签』 阅读(27)
评论(0) 编辑 收藏 所属分类:
ASP.NET

Sub page_load()sub page_load(o as object,e as eventargs)

if ispostback then exit sub

dim obj as new DatabaseDo

obj.connstr=ConfigurationSettings.AppSettings("ConnstrACC")

dim ds as dataset

'====================

'== 绑定数据类型 ==

'====================

ds=obj.getdataset("select * from Ip")

IP.datasource=ds

IP.databind

end sub



<asp:Repeater ID="Newslist" runat="server">

<ItemTemplate>

<tr align="center" valign="middle">

<td>

<%# DataBinder.Eval(Container.Dataitem,"ipid") %>

</td>

</tr>

</ItemTemplate>

</asp:Repeater>






Sub page_load()sub page_load(o as object,e as eventargs)

dim obj as new databaseDo

dim ds as dataset

obj.connstr=ConfigurationSettings.AppSettings("Connstr")



ds=obj.getdataset("select iid,iname,idesc1,sysdate,iimage from information where itype=1 order by sysdate ")

tjList.datasource=ds

tjList.databind()



ds=obj.getdataset("select top 10 iid,iname,idesc1,sysdate,iimage from information where itype=7 order by sysdate desc ")

tjList1.datasource=ds

tjList1.databind()



ds=obj.getdataset("select * from datalist where isshow='Y' and ptype=1")

ProductListA.datasource=ds

ProductListA.databind()



ds=obj.getdataset("select * from datalist where isshow='Y' and ptype=2")

ProductListB.datasource=ds

ProductListB.databind()


Label显示方法

ds=obj.getdataset("select count(*) c from information where itype=7")

intQty.text=ds.tables(0).rows(0).item("c")

end sub