关于datagrid的问题。
建了个空的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