我用gridview控件绑定数据为什么不显示数据啊? 代码如下
rotectedSubButton1_Click(ByValsenderAsObject,ByValeAsSystem.EventArgs)HandlesButton1....
rotected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim conn As New OleDbConnection("provider=microsoft.jet.oledb.4.0;Data Source=" & Server.MapPath("classmate.mdb"))
Dim cmd As New OleDbCommand("select * from class where xuehao='" & TextBox1.Text & "'", conn)
conn.Open()
Dim dr As OleDbDataReader = cmd.ExecuteReader()
GridView1.DataSource = dr
GridView1.DataBind()
conn.Close() 展开
Dim conn As New OleDbConnection("provider=microsoft.jet.oledb.4.0;Data Source=" & Server.MapPath("classmate.mdb"))
Dim cmd As New OleDbCommand("select * from class where xuehao='" & TextBox1.Text & "'", conn)
conn.Open()
Dim dr As OleDbDataReader = cmd.ExecuteReader()
GridView1.DataSource = dr
GridView1.DataBind()
conn.Close() 展开
展开全部
遇到同样的问题,dr要怎么赋值呢,已经是读取datareader的值了啊
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你有调试?
看看dr的值吧!
看看dr的值吧!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
dr没有赋值怎么会有数据呢?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询