主题:[讨论]DataGrid 的排序问题? 出现了异常问题(请教高手)
<%@import namespace="system.data"%>
<%@import namespace="system.data.oledb"%>
<script language="vb" runat="server">
sub data(sortingstring as string)
dim connstring as string="provider=microsoft.jet.oeldb.4.0;" & _
"data source ="&server.mappath("Grades.mdb")
dim cmdobject as new oledbdataadapter("select *from 成绩单",connstring)
dim ds as new dataset()
cmdobject.fill(ds,"成绩单")
dim dt as datatable = ds.tables("成绩单")
dim dv as dataview
dv = new dataview(dt)
dv.sort=sortingstring
dg.datasource=dv
dg.databind()
end sub
sub page_load(sender as object,e as eventargs)
data("")
end sub
sub dg_sc(sender as object, e as datagridsortcommandeventargs)
data(e.sortexpression.tostring)
end sub
</script>
<html>
<body>
<form runat="server">
<asp:datagrid id="dg" runat="server" allowsorting="true" onsortcommand="dg_sc" >
</asp:datagrid>
</form>
</body>
</html>
<%@import namespace="system.data.oledb"%>
<script language="vb" runat="server">
sub data(sortingstring as string)
dim connstring as string="provider=microsoft.jet.oeldb.4.0;" & _
"data source ="&server.mappath("Grades.mdb")
dim cmdobject as new oledbdataadapter("select *from 成绩单",connstring)
dim ds as new dataset()
cmdobject.fill(ds,"成绩单")
dim dt as datatable = ds.tables("成绩单")
dim dv as dataview
dv = new dataview(dt)
dv.sort=sortingstring
dg.datasource=dv
dg.databind()
end sub
sub page_load(sender as object,e as eventargs)
data("")
end sub
sub dg_sc(sender as object, e as datagridsortcommandeventargs)
data(e.sortexpression.tostring)
end sub
</script>
<html>
<body>
<form runat="server">
<asp:datagrid id="dg" runat="server" allowsorting="true" onsortcommand="dg_sc" >
</asp:datagrid>
</form>
</body>
</html>