| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 805 人关注过本帖
标题:DataGrid数据库绑定
只看楼主 加入收藏
jdw1984228
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2006-12-8
收藏
 问题点数:0 回复次数:2 
DataGrid数据库绑定
Dim strsql As String
Dim adoRead As SqlDataReader
Dim conStr As New clsAdoNetSql
strsql = "SELECT STUDENT_ID,STUDENT_NAME,INSERT_DATE FROM T_BASE_INFO WHERE DELETE_FLG=1"
Try
adoRead = conStr.RunQueryCmd(strsql)
If adoRead Is Nothing Then
dgField.DataSource = adoRead
dgField.DataBind()
adoRead.Close()
conStr.CloseConnection()
End If
Catch ex As Exception
If Not adoRead Is Nothing Then
adoRead.Close()
conStr.CloseConnection()
End If
End Try
这一段代码有问题吗??为什么我不能显示数据??
搜索更多相关主题的帖子: 数据库 绑定 DataGrid adoRead strsql 
2006-12-25 16:06
bygg
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:乖乖的心中
等 级:版主
威 望:241
帖 子:13555
专家分:3076
注 册:2006-10-23
收藏
得分:0 
以下是引用jdw1984228在2006-12-25 16:06:37的发言:
Dim strsql As String
Dim adoRead As SqlDataReader
Dim conStr As New clsAdoNetSql
strsql = "SELECT STUDENT_ID,STUDENT_NAME,INSERT_DATE FROM T_BASE_INFO WHERE DELETE_FLG=1"
Try
adoRead = conStr.RunQueryCmd(strsql)
If adoRead.Read() Then
dgField.DataSource = adoRead
dgField.DataBind()
adoRead.Close()
conStr.CloseConnection()
End If
Catch ex As Exception
If Not adoRead Is Nothing Then
adoRead.Close()
conStr.CloseConnection()
End If
End Try
这一段代码有问题吗??为什么我不能显示数据??

试试这样,
要不就用数据集.


飘过~~
2006-12-25 16:23
jdw1984228
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2006-12-8
收藏
得分:0 

谢谢了!

2006-12-25 16:40
快速回复:DataGrid数据库绑定
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014424 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved