Problem with (new) datagrid / dataset
I have a dataset in a Datagrid that is not working the way that is should. At one time it was fine but somehow I messed it up
When I first load the dataset this is what I get
http://www.liberty1st.org/images_hm/im01.jpg
Then (Once Clicked)
http://www.liberty1st.org/images_hm/im02.jpg
And finally (After Second Click)
http://www.liberty1st.org/images_hm/im03.jpg
It used to open up with the full grid loaded the first time. Here is the code I am using. Any ideas what went wrong and how to fix it?
VB Code:
Private Sub RefillDataGrid()
Dim cnn As New OleDb.OleDbConnection( _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & strDataBaseName)
Dim cmd As New OleDb.OleDbCommand
cnn.Open()
cmd.Connection = cnn
Dim da As New OleDb.OleDbDataAdapter
Dim DsPayroll1 As New DataSet
Try
cmd = cnn.CreateCommand
cmd.CommandText = "Select * From TimeGR"
'***********************************************
'"Select * From TimeGR Where EmployeeNumber='" & _
'(txtEmp.Text) & "'"
'***********************************************
da.SelectCommand = cmd
da.Fill(DsPayroll1, "TimeGR")
DataGrid1.DataSource = DsPayroll1
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, _
MsgBoxStyle.OKCancel, "Populate Datagrid")
End Try
cnn.Close()
Thanks