您的位置:首页 > 编程语言 > VB

[VB.NET]清空datagrid中的数据

2008-12-28 14:01 344 查看



<script type="text/javascript"><!--
google_ad_client = "pub-8333940862668978";
/* 728x90, 创建于 08-11-30 */
google_ad_slot = "4485230109";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

清空datagrid中的数据
怎样删除vb.net 中datagrid中第一次查询已有的全部数据
等到第二次查询的时候要让datagrid为空的网格使得数据从datagrid的第一行开始显示数据。
请愿书大哥大姐们帮个忙吧!
__________________________________________________________________________
''清除DataGrid控件中的数据
DataGrid1.DataSource = Nothing
__________________________________________________________________________
同上
__________________________________________________________________________
如果你是用 DataGrid1.DataSource =dataset1来连接的,你只在改变dataset1就行了,不需要清空
__________________________________________________________________________
鎴戠殑绯荤粺鏄疿P锛岃浜咺IS5.0鍚庯紝鍦ㄧ鐞嗗伐鍏封€斺€?Internet淇℃伅鏈嶅姟锛?鏈湴璁$畻鏈猴紞> 缃戠珯锛?榛樿缃戠珯鐨勭姸鍐垫€绘槸鈥滃仠姝⑩€濓紝鍥炬爣鎬绘槸涓€涓孩鑹茬殑鈥渆rror鈥濓紝鍙槸瑁呭畬IIS鍚庢垜鏌ヤ簡
__________________________________________________________________________
dim pt as new sqldataadapter(selectcommand,connection)
dim ds as new datset
pt.fill(ds)
me.datagrid.datasource=ds.tables(0)

pt =new saldataadapter(newselectcommand,connection)
pt.fill(ds)

如果selectcommand和newselectcommand不同,则加一句
me.datagrid.datasource=ds.tables(0)

*****************************************************************************
欢迎使用CSDN论坛专用阅读器 : CSDN Reader(附全部源代码)
http://www.cnblogs.com/feiyun0112/archive/2006/09/20/509783.html __________________________________________________________________________
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息