各位高手指教:莫非是。NET的BUG,高手请进。(关于DATATABLE)
声明页面全局变量:
Public shared dt as new datatable()
private sub loaddata()
dt.columns.add(new datacolumn("test",gettype(string)))
......
dim dr as datarow
dr=dt.newrow()
dr(0)=""
dt.rows.add(dr)
datagrid1.datasource=dt
datagrid1.databind()
end sub
page_load 事件:
if not ispostback then
call loaddata()
end if
问题是第一次加载页面时,没有问题,第二次加载,则出现如下错误:
test列已存在,刷新些页面,同样错误,莫非是。NET的BUG
请各位高手测试指教。
问题点数:0、回复次数:3Top
1 楼xyfeng78(dd)回复于 2003-09-01 22:27:47 得分 0
可怜啊,没分就没人理了。
高手都上那儿了,江雨,思归????Top
2 楼saucer(思归)回复于 2003-09-01 22:31:31 得分 0
you are using shared variable:
Public shared dt as new datatable()
you should be checking the number of columns, for example:
private sub loaddata()
if dt.Columns.Count = 0 then
dt.columns.add(new datacolumn("test",gettype(string)))
end if
....Top
3 楼coolmars(mars)回复于 2003-09-02 00:02:38 得分 0
upTop



