回 帖 发 新 帖 刷新版面

主题:为什么要大写啊,

<%@ page language="vb" debug="true"%>
<%@ import namespace="system.data"%>
<%@ import namespace="system.data.oledb"%>
<%@ import namespace="system.string"%>
<html >
<head>
<title>dataview对象</title>
<script language="vb" runat=server >
private sub page_load(byval sender as object,byval e as eventargs)
dim cnn as oledbconnection
dim cmd as oledbcommand
dim dtd ,dtd1 as datatable
dim drow as datarow
cnn=new oledbconnection("provider=microsoft.jet.oledb.4.0;data source=c:\gjjdb.mdb")
cnn.open()
cmd =new oledbcommand("select * from web",cnn)
dtd=new datatable("goods")
[b]dtd.columns.add("商品编号",System.Type.Gettype("System.String"))
dtd.columns.add("商品名称",system.type.gettype("System.String"))
dtd.columns.add("产地",system.type.gettype("System.String"))
dtd.columns.add("颜色",system.type.gettype("System.String"))[/b]
'“system.string”如果小写就不行啊,
dim thekey() as datacolumn={dtd.columns("商品编号")}
dtd.primarykey=thekey
drow=dtd.newrow
drow(0)="001"
drow(1)="洗衣机"
drow(2)="湘潭”
drow(3)="白色"
dtd.rows.add(drow)
drow=dtd.newrow
drow(0)="002"
drow(1)="洗衣粉"
drow(2)="上海"
drow(3)="绿色"
dtd.rows.add(drow)
dim dview as dataview
dview=new dataview(dtd)
dview.rowfilter="商品名称 like '%洗衣%'"
dview.sort="商品编号,商品名称"
dim str() as string={"002","洗衣机"}
dim i as int32
i=dview.find(str)
dgd.datasource=dview
dgd.databind()
end sub
</script>
</head>
<body >
<center><h2><font color=#33cccc>使用dataview对象显示数据</font></h2></center>
<form id="form1" runat=server >
<asp:DataGrid ID ="dgd" Runat =server align="cener" >
</asp:DataGrid>
</form>

</body>
</html>

回复列表 (共2个回复)

沙发

ASP.net 是区分大小写的吧

板凳

因为这是微软定的规矩
回答完毕

我来回复

您尚未登录,请登录后再回复。点此登录或注册