关于datagrid的问题。

dz08039 dz08039 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
建了个空的datagrid和dataset,然后将datagrid绑定dataset,然后通过语句刷新datgrid,但表是折叠需点击才能打开,怎么能直接显示选择的表.

程序如下:
Dim myConnection As New SqlConnection(myConnectionString)
Dim myInsertQuery As String = "select label1,label2,label3,label4,label5 from test"
Dim myCommand As New SqlCommand(myInsertQuery)
Dim adapter As New SqlDataAdapter
myCommand.Connection = myConnection
Try
myConnection.Open()
adapter.SelectCommand = myCommand
adapter.Fill(DataSet1)
DataGrid1.Refresh()
myCommand.Connection.Close()
bDbOpen = True
Catch ex As Exception
bDbOpen = False
MsgBox(ex.Message)
End Try
...全文

相关推荐

评论 3
收藏 已收藏
分享
返回顶部
dz08039
VB 16,718 成员 110,520 内容