Z
zhjihui
Unregistered / Unconfirmed
GUEST, unregistred user!
<%@ import namespace="system.data"%>
<%@ import namespace="system.data.sqlclient"%>
<HTML>
<HEAD>
<title></title>
<script language="vb" runat="server">
sub page_load(sender as object,e as eventargs)
dim objconn as sqlconnection
dim objcmd as sqldataadapter
dim objds as new dataset
dim strsql as string="select * from memorabilia "
dim strdsn as string
strdsn="server='DB-BACKUP';uid=qymh;pwd=qymh;database=qymh;"
objconn=new sqlconnection(strdsn)
objcmd=new sqldataadapter()
objcmd.tablemappings.add("table","memorabilia")
objcmd.selectcommand=new sqlcommand(strsql,objconn)
objds=new dataset("memorabilia")
objcmd.fill(objds)
grid1.datasource=objds.tables("memorabilia").defaultview
grid1.databind()
end sub
</script>
</HEAD>
<body>
<asp:datagrid id=grid1 Runat="server" ItemStyle-ForeColor="black" ItemStyle-BackColor="#ffcc66" HeaderStyle-ForeColor="red" HeaderStyle-BackColor="lightblue" >
<HeaderStyle ForeColor="Red" BackColor="LightBlue"></HeaderStyle>
<ItemStyle ForeColor="Black" BackColor="#FFCC66"></ItemStyle>
<Columns>
<asp:BoundColumn DataField="id"></asp:BoundColumn>
</Columns>
</asp:datagrid>
</body>
</HTML>
有什么不对的地方,为什么总说objds未声明
<%@ import namespace="system.data.sqlclient"%>
<HTML>
<HEAD>
<title></title>
<script language="vb" runat="server">
sub page_load(sender as object,e as eventargs)
dim objconn as sqlconnection
dim objcmd as sqldataadapter
dim objds as new dataset
dim strsql as string="select * from memorabilia "
dim strdsn as string
strdsn="server='DB-BACKUP';uid=qymh;pwd=qymh;database=qymh;"
objconn=new sqlconnection(strdsn)
objcmd=new sqldataadapter()
objcmd.tablemappings.add("table","memorabilia")
objcmd.selectcommand=new sqlcommand(strsql,objconn)
objds=new dataset("memorabilia")
objcmd.fill(objds)
grid1.datasource=objds.tables("memorabilia").defaultview
grid1.databind()
end sub
</script>
</HEAD>
<body>
<asp:datagrid id=grid1 Runat="server" ItemStyle-ForeColor="black" ItemStyle-BackColor="#ffcc66" HeaderStyle-ForeColor="red" HeaderStyle-BackColor="lightblue" >
<HeaderStyle ForeColor="Red" BackColor="LightBlue"></HeaderStyle>
<ItemStyle ForeColor="Black" BackColor="#FFCC66"></ItemStyle>
<Columns>
<asp:BoundColumn DataField="id"></asp:BoundColumn>
</Columns>
</asp:datagrid>
</body>
</HTML>
有什么不对的地方,为什么总说objds未声明