修改:塞北的雪
<
%@ page language
=
"
vb
"
%
>
< %@ import namespace = "system" %>
<%@ import namespace = "system.xml" %>
<%@ import namespace = "system.io" %>
<%@ import namespace = "system.collections" %>
<%@ import namespace = "system.web" %>
<%@ import namespace = "system.web.ui" %>
<%@ import namespace = "system.web.ui.webcontrols" %>
<%@ import namespace = "system.data" %>
<%@ import namespace = "system.drawing" %>
<script runat="server">
sub page_load( sender as object, e as system.eventargs)
dim dir as directoryinfo = new directoryinfo(server.mappath("remark"))
dim files as fileinfo() = dir.getfiles()
dim count as integer = files.length
dim i as integer
dim j as integer
dim k as integer
for i = 0 to count - 1
if files(i).name.substring(files(i).name.lastindexof(".")) = ".xml" then
dim ds as new dataset()
ds.readxml(files(i).fullname)
for k=0 to ds.tables.count-1
dim dt as datagrid = new datagrid()
dt.id = "datagrid" + i.tostring() + k.tostring()
dt.headerstyle.backcolor=color.red
dt.autogeneratecolumns=false
dim myname as boundcolumn()
redim myname(ds.tables(k).columns.count)
for j=0 to ds.tables(k).columns.count-1
myname(j)=new boundcolumn()
myname(j).headertext=ds.tables(k).columns(j).columnname
myname(j).datafield=ds.tables(k).columns(j).columnname
dt.columns.addat(0, myname(j))
next
dt.datasource = ds.tables(k)
dt.databind()
me.controls.add(dt)
next
end if
next
end sub
</script>
< %@ import namespace = "system" %>
<%@ import namespace = "system.xml" %>
<%@ import namespace = "system.io" %>
<%@ import namespace = "system.collections" %>
<%@ import namespace = "system.web" %>
<%@ import namespace = "system.web.ui" %>
<%@ import namespace = "system.web.ui.webcontrols" %>
<%@ import namespace = "system.data" %>
<%@ import namespace = "system.drawing" %>
<script runat="server">
sub page_load( sender as object, e as system.eventargs)
dim dir as directoryinfo = new directoryinfo(server.mappath("remark"))
dim files as fileinfo() = dir.getfiles()
dim count as integer = files.length
dim i as integer
dim j as integer
dim k as integer
for i = 0 to count - 1
if files(i).name.substring(files(i).name.lastindexof(".")) = ".xml" then
dim ds as new dataset()
ds.readxml(files(i).fullname)
for k=0 to ds.tables.count-1
dim dt as datagrid = new datagrid()
dt.id = "datagrid" + i.tostring() + k.tostring()
dt.headerstyle.backcolor=color.red
dt.autogeneratecolumns=false
dim myname as boundcolumn()
redim myname(ds.tables(k).columns.count)
for j=0 to ds.tables(k).columns.count-1
myname(j)=new boundcolumn()
myname(j).headertext=ds.tables(k).columns(j).columnname
myname(j).datafield=ds.tables(k).columns(j).columnname
dt.columns.addat(0, myname(j))
next
dt.datasource = ds.tables(k)
dt.databind()
me.controls.add(dt)
next
end if
next
end sub
</script>